Add, delete and manipulate DOM nodes
Here are examples taken from some of my code just to memorize common use node functions. I hope they are self-explanatory.
// Clone DOM node
var movingUrl = urlLineSPAN.cloneNode(true);
// Get Parent node
var urlList = urlLineSPAN.parentNode;
// Delete DOM Node
urlList.removeChild(urlLineSPAN);
// Add DOM node
urlAreaObj.appendChild(newNode);
// or
urlAreaObj.insertBefore(newNode, existingNode);
Comments
Post a Comment