mercredi 25 février 2015

Which one is best for performance in jquery select class names vs id's


Vote count:

0




I have along div's for accordion menu with each has id's likes



<div id='sampe_1' class='sample'></div>
<div id='sampe_2' class='sample'></div>
<div id='sampe_3' class='sample'></div>

<div id='sampe_100' class='sample'></div>


For expand and collapse To find all div's i am using below two methods


$("div[id^='supplier_']"); I got all 100 div no i loop 1000 times and click event


or


Direct click event with class name



$('.sample').on('click');


In above both which one best or any better process



asked 22 secs ago







Which one is best for performance in jquery select class names vs id's

Aucun commentaire:

Enregistrer un commentaire