Demonstrate the different selectors in jQuery like elements, class, attribute etc.
Ex.
$("[href]") // elements with href attribute
$(".mindstick") // elements with class="mindstick"
$("#myname") // elements with id="myname"
$("[title^='prakash']") // elements with attribute which start with "prakash".
Id and elements are faster than class selector because id will be unique and it's only one time matched data with DOM's database than stoped , but when you uses class it's called many times from DB and it's performance will get slow.
Happy Coding :)
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
jQuery selectors:
Demonstrate the different selectors in jQuery like elements, class, attribute etc.
Ex.
$("[href]") // elements with href attribute$(".mindstick") // elements with class="mindstick"
$("#myname") // elements with id="myname"
$("[title^='prakash']") // elements with attribute which start with "prakash".
Id and elements are faster than class selector because id will be unique and it's only one time matched data with DOM's database than stoped , but when you uses class it's called many times from DB and it's performance will get slow.
Happy Coding :)