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:
- document.querySelector('container').remove()
it remove container element from document - document.querySelectorAll('ul').remove()
it remove all UL elements from DOM. - 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
Post a Comment