javascript : .nextAll()
javascript : .nextAll()
Target:
Applicable with any DOM element.
- getElementById
- getElementsByTagName
- getElementsByClassName
- getElementsByName
- querySelector
- querySelectorAll
- select
- etc.
Description :
return DOMNodeList of next all sibling elements of selected element.
Note: if selector is DOM Elements List then first node element's next all sibling nodes return as DOMNodeList.
Syntax:
DOMElement.nextAll()
DOMNodeList.nextAll()
HTMLCollection.nextAll()
Usase:
- document.getElementById('firstDiv').nextAll()
it search element having id firstDive and return all elements next to it in same parent as DOMNodeList. - document.getElementsByTagName('div').nextAll()
the getElementsByTagName selects all div and nextAll() method return first div's next all sibling nodes as DOMNodeList - document.getElementsByClassName('FirstDiv').nextAll()
the getElementsByClassName selects all div having class "FirstDiv" and nextAll() method return first element's next all sibling nodes as DOMNodeList. - document.getElementsByName('FirstDiv').nextAll()
the getElementsByName selects all elements having name attribute "FirstDiv" and nextAll() method return first element's next all sibling nodes as DOMNodeList. - document.querySelector('.FirstDiv').nextAll()
the querySelector selects first div having class "FirstDiv" and nextAll() method return next all elements as DOMNodeList. - document.querySelectorAll('.FirstDiv').nextAll()
the querySelectorAll selects all div having class "FirstDiv" and nextAll() method return first element's next all sibling nodes as DOMNodeList.
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