To remove an element using javascript, you can use one of the following snippets.
Sample Javascript
//usage document.getElementById("ElementId").remove(); Element.prototype.remove = function() { this.parentElement.removeChild(this); }
Sample Javascript
//usage document.getElementsByClassName("Elements").remove(); NodeList.prototype.remove = HTMLCollection.prototype.remove = function() { for(var index = 0, length = this.length; index < length; index++) { if(this[index] && this[index].parentElement) { this[index].parentElement.removeChild(this[index]); } } }
removeChild() is the only method supported by the DOM to remove a element in Javascript (see -> Mozilla MDN Node.removeChild()).
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…
RT @CodeSnippetsNET: How to remove an element using #Javascript http://t.co/iGF4BIJ6fj #js #jquery #html #css #html5 #php #codesnippets #pr…