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

Popular posts from this blog

Conceptual design

Using Trello and Confluence to manage UX design project. Part 1

How do I use InVision