jquery selectors

Total Post:2


 792  View(s)
Rate this:

Why id & elements are faster? &

why class selectors are slow?

  1. Re: jquery selectors

    jQuery selectors:

    Demonstrate the different selectors in jQuery like elements, class, attribute etc.


    $("[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 :)

      Modified On Jun-06-2018 11:17:52 PM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.