javascript : domElement .remove()

 

javascript : domElement .remove()


Target:

remove selected element from DOM.

  • getElementById
  • getElementsByTagName
  • getElementsByClassName
  • getElementsByName
  • querySelector
  • querySelectorAll

Description :

remove all element and it's children from DOM.


Note: it return nothing.


Syntax:

DOMElement.remove()

DOMNodeList.remove()

HTMLCollection.remove()


Usase:

  1. document.querySelector('container').remove()
    it remove container element from document
  2. document.querySelectorAll('ul').remove()
    it remove all UL elements from DOM.
  3. document.getElementsByClassName('output').remove()
    it remove all elements having class name output.


Download MYJS.js

MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type. 

Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.

Comments

Popular posts from this blog

javascript : String.right

javascript : String.left

javascript : .nextAll()