Get inner or outer HTML - Node.js DOM

Node.js examples for DOM:Element

Description

Get inner or outer HTML

Demo Code

outerHTML: function (node) {
  // if IE, Chrome take the internal method otherwise build one
  return node.outerHTML || (function (n) {
    var div = document.createElement('div'), h;
    div.appendChild(n.cloneNode(true));/*w ww.j  av  a2  s .c o  m*/
    h = div.innerHTML;
    div = null;
    return h;
  })(node);
},

Related Tutorials