Create element - Node.js DOM

Node.js examples for DOM:Element

Description

Create element

Demo Code

function createElement(type, className, parent) {
  var node = document.createElement(type);
  if (className)/*ww w .ja  v  a 2  s . c  om*/
    node.className = className;
  if (parent)
    parent.appendChild(node);
  return node;
}

Related Tutorials