Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:49:28+00:00 2026-06-10T05:49:28+00:00

so in my page I’ll be inserting a series of elements, let’s say with

  • 0

so in my page I’ll be inserting a series of elements, let’s say with class name “element” but some of them will be disabled, which will get additional class “disabled”. Now I want to bind a click event to all non-disabled elements, and I was just wondering if performance wise it’s better to just write

$(".element:not(.disabled)") .live("click",function() { ...

or should I bind a click event to each individual elements as they are being inserted ?

p.s. I know .on has replaced .live, but right now im using version 1.6.2, so can’t change that

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:49:30+00:00Added an answer on June 10, 2026 at 5:49 am

    First off, you should never be using .live() any more as it has been deprecated for all versions of jQuery. I would suggest this:

    $(document).on('click', '.element:not(.disabled)', function() {...});
    

    There should be little performance issue with this because the comparison to the selector only happens when a click occurs and when the comparison is done, it’s a fairly simple comparison to just the check the target’s class name.

    Also, since a click is a user action that occurs in user time and the selector comparison is not complex at all, it is highly unlikely that any delay could be noticable (we’re talking about milliseconds here at most).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The page I am building should display a list of items. Let's say these
page = 1; $('.links').click(function() { $(this).removeAttr('href'); page = $(this).html(); }); <a href=# class=links> 1
Page in question: http://www.rjlacount.com/public/lander/ I'm probably just doing something stupid, but I'm trying to
page.xml.php will not show any output, in firebug I can see the get response
This page about storage quotas says to use the mscorcfg tool. BUT the mscorcfg
Page my question is referring to: http://raphaeljs.com/australia.html Can some kind individual please tell me
Page contains single form with input elements and jqgrid data. jqGrid data is retrieved
Page 146 of the jQuery mobile First look book mentions data-placeholder, but I don't
Page works fine in chrome, and IE 9 compatibility mode but not in actual
page.xml contains: <default translate=label module=page> <label>All Pages</label> <reference name=root> <action method=addBodyClass><className>testing</className></action> </reference> Yet it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.