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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:56:51+00:00 2026-05-16T07:56:51+00:00

I am trying to prevent multiple clicks on links and items, which is causing

  • 0

I am trying to prevent multiple clicks on links and items, which is causing problems.

I am using jQuery to bind click events to buttons (jQuery UI) and image links (<a><img /></a>).

Is there a way to do-once-for-all prevent other events from firing after a click occurs?

Or do I have to maintain a global variable called _isProcessing and set it to true for each event handler?

Thanks

Edit: (clarification)
Thanks for your answers, my problem isn’t preventing the bubbling of the event, but preventing multiple concurrent clicks.

  • 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-05-16T07:56:51+00:00Added an answer on May 16, 2026 at 7:56 am

    There are various ways to prevent concurrent clicks from running the code.

    One way is to unbind('click') on the element, then .bind() it again when you’re ready.

    I’d rather use some sort of flag. It could be a variable, but I’d rather assign a class to the element, like .processing, and remove it when done. So you would have the handler check for the existence of that class to determine of the code should run.

    $('someElement').click(function() {
        var $th = $(this);
        if($th.hasClass('processing'))
              return;
        $th.addClass('processing');
        // normal code to run
        // then when done remove the class
        $th.removeClass('processing');
    });
    

    Another option is to use the elements .data() to set a similar flag, like $(this).data('processing', true); Then set it to false when done.

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

Sidebar

Related Questions

I'm trying to check which of four submit buttons was pressed, using jQuery 1.7.2
I have multiple superposed controls which can handle a mouse click under certain conditions.
I am trying to prevent duplicated data to database when the user click the
I am trying to prevent multiple simultaneous logins in my web application. I want
I am trying to implement multiple Facebook share buttons in one page to share
I'm trying to figure out how I can prevent multiple of the class asks
I'm trying to author a family of class libraries which are used between multiple
I am trying to prevent my program from running multiple instances at any given
Trying to prevent access to a specific file, not any files with a certain
I'm trying to prevent certain keys from being entered into an input box, but

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.