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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:42:13+00:00 2026-05-30T20:42:13+00:00

I have this easy code : <a href=# id=link1>Link1</a> <a href=# id=link2>Link2</a>​ $(‘#link1’).click(function ()

  • 0

I have this easy code :

<a href="#" id="link1">Link1</a>
<a href="#" id="link2">Link2</a>​

$('#link1').click(function () {
    alert("First");
});

$('#link2').click(function () {
    alert("Second");    
});    
​

in a “remote” possiblity that a user click on Link1 (first) and than on Link2, with a difference of 0,000000001 ms (I know, is it impossible in the reality, but is just to know), is it possible that the alert of #link2 start before the alert of #link1?

And if yes, what’s the solution to block handler of #link2 till the action of #link1 is it not finished?

  • 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-30T20:42:14+00:00Added an answer on May 30, 2026 at 8:42 pm

    “…is it possible that the alert of #link2 start before the alert of #link1?”

    No. If the clicks actually happen in that order, the events will be triggered in that order.

    JavaScript is single threaded, and the event systems are synchronous. This guarantees that the synchronous portion of the first click must complete before the second click event is allowed.

    If asynchronous code is introduced into the handler for the first click, then the first click will still begin first, but the second click could start if it takes place before the first click’s asynchronous code runs.


    To simulate a super fast sequence of clicks, just have the code trigger the events.

    var l1 = $('#link1');
    var l2 = $('#link2');
    
    l1.click();  // this alert will always come first
    l2.click();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code right now: $(document).ready(function () { $(div#main-edit).click( function() { var cursorExists
Now I'm sure this is super easy, I have a function called remove_deposit which
I have this jQuery code: <script type=text/javascript> $(function() { $(.one-edition img).hover(function() { $(this).next(.editions-info-text).show(); },
I have this ridicolously easy piece of code. It works flawlessly on Firefox and
I have this code, is there an easy way to limit the amount of
I have this seemingly easy issue in FF4. In the code below I need
I have this code which is pretty easy, it adds an image to the
Assuming I have this code: function question($argument) { var $q = What does ($argument)
I have this easy little form in my JavaFX application. I want to use
I am coming from c# where this was easy, and possible. I have this

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.