javascript : .select(cssSelector)
javascript : .select(cssSelector)
Target:
Applicable with any DOM element or elements List.
- document
- getElementById
- getElementsByTagName
- getElementsByClassName
- getElementsByName
- querySelector
- querySelectorAll
- select
- find
- filter
- filterNot
- not
- visible
- nextAll
- prevAll
- next
- prev
- closest
Description :
It search selector element in the document/element/elements list itself or children and return all DOMNodeList that are matched with selector passed.
Syntax:
Document.select(selector)
DOMElement.select(selector)
DOMNodeList.select(selector)
HTMLCollection.select(selector)
Note : selector may be any css selector string or DomElement
Usase:
- document.select('#firstDiv input')
it search input elements in firstDiv and return DOMNodeList of all input elements inside firstDiv. - document.select('.divExample').select('li).select('span') It find ".divExample" in document and then find "li" in result list and then find "span" in next result list.
- document.getElementsByTagName('div').select('input')
the getElementsByTagName selects all div and select() method seaches input elements in all dives and return DOMNodeList of input elements. - document.getElementsByClassName('FirstDiv').select('input')
the getElementsByClassName selects all elements having class FirstDiv and select() method seaches input elements in all elements and returns DOMNodeList on input elements. - document.getElementsByName('FirstDiv').select('input')
the getElementsByName selects all elements having name attribute "FirstDiv" and select() method searches input elements in all elements and returns DOMNodeList of input elements. - document.querySelector('.FirstDiv').select('input')
the querySelector selects first div having class "FirstDiv" and select() method search input elements in firstDiv and return DOMNodeList of input elements. - document.querySelectorAll('.FirstDiv').select('input')
the querySelectorAll selects all elements having class FirstDiv and select() method search input elements in every elements and returns DOMNodeList of input elements. - var divExample=document.querySelector('.divExample');document.select(divExample);It convert and return domElement to 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