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 8027427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:48:31+00:00 2026-06-04T23:48:31+00:00

What i have: $(‘#main’).find(‘*’).on(‘click.stop’, function() {return false;}); What i want: Changing the selector ‘*’

  • 0

What i have:

$('#main').find('*').on('click.stop', function() {return false;});

What i want:
Changing the selector '*' to all classes with a bound click_handler because of performance issues.


My idea: Assigning additional classes when binding a handler to a class.


Problem with idea: The amount of code i would have to change is too damn high! and i am very lazy…

  • 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-04T23:48:32+00:00Added an answer on June 4, 2026 at 11:48 pm

    You can write your expression to do this. jQuery does not support this selector natively.

    jQuery.extend(jQuery.expr[':'], {     
      click: function(elem) { 
           return $(elem).hasEvent('click');    
      } 
    });
    

    Then, you can use:
    $("*:click").on('click.stop',...

    hasEvent:

    $.fn.hasEvent = function(event, fn) {
    if (!event) { return this; }
    var has = {
          event: false,
          namespace: false,
          handler: false
        },
        events = this.data("events"),
        namespace = event.split(".");
    event = namespace.shift();
    namespace = namespace.join(".");
    if (events) {
      if (!namespace) { has.namespace = true; }
      if (!fn) { has.handler = true; }
      if (event in events) {
        $.each(events[event], function(i, v) {
          if (namespace) {
            if (namespace === v.namespace && event === v.type) {
              has.namespace = true;
              has.event = true;
              if (fn && fn === v.handler) { has.handler = true; }
            }
          }
          else {
            if (event === v.type) {
              has.event = true;
              if (fn && fn === v.handler) { has.handler = true; }
            }
          }
        });
      }
    }
    return has.event && has.namespace && has.handler;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have a php code like this,going to convert it in to C#. function isValid($n){
Have an issue with jquery autocomplete, focus function After i type something in the
Have a rather abstract question for you all. I'm looking at getting involved in
Have finally got a responsive site working (of a fashion). What I want to
Have a look at the following code to find X^y. /* Find exponent in
Have written all the code in a silverlight class library (dll) and linked this
have you ever found a problem when assigning a click event handler for your
I have a text area in my form which accepts all possible characters from
Have you any idea how to find out if spell check suggestions dialog is
Have such a problem, hope you'll help me.. Can't find anywhere. Here is the

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.