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 :)
Liked By
Write Answer
jquery selectors
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
Join MindStick Community
You have need login or register for voting of answers or question.
Prakash nidhi Verma
06-Jun-2018jQuery 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 :)