Removing an element with the plain JavaScript remove() method http://ift.tt/1mqUyQz...

Please Visit: http://ift.tt/1ajReyV



Removing an element with the plain JavaScript remove() method

http://ift.tt/1jQX4Co

The bulletproof way

var elem = document.getElementById("myDiv");

elem.parentNode.removeChild(elem);

The jQuery way

$('#myDiv').remove();

The new way. FTW.

var elem = document.getElementById("myDiv");

elem.remove();



Remove an element with the plain JavaScript remove() method available in the current DOM4 specs along with other mutation methods like append(), prepend(), before(), after() and replace().







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1jQX4Cy

via LifeLong Community

No comments:

Post a Comment