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

  • Home
  • SEARCH
  • 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 8530951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:22:21+00:00 2026-06-11T09:22:21+00:00

Having this sample code: <input type=text id=changeid> <a href=# id=clickb>click</a> <script> $(‘#clickb’).on(click, function(event){ alert(1);

  • 0

Having this sample code:

<input type="text" id="changeid">
<a href="#" id="clickb">click</a>

<script>
    $('#clickb').on("click", function(event){
        alert(1);                             
        return false;
    });

    $('#changeid').on("change", function(event){
        alert(2);                             
        return false;
    });
</script>

When putting something into the text field and click the link immediately, only onchange event fires, but not link click event.
Why is that?
It seems that the change event is blocking the click event?

  • 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-11T09:22:22+00:00Added an answer on June 11, 2026 at 9:22 am

    When you edit the input and then click on the link the following happens on the inside

    1. You start clicking on the ‘link’. No events are generated yet (not even mousedown), because first the browser will do some cleanup work:
    2. The input loses focus and will raise a blur event
    3. The input raises a change event, since it raised a blur and the value changed
    4. Your change event callback opens an alert(2)
    5. The documents loses focus since a new window appeared
    6. The link will never experience the click.

    The solution is not to use alert (as xdazz proposed).

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

Sidebar

Related Questions

<script type=text/javascript> $(document).ready(function($){ $.supersized({ //Background image slides : [ { image : 'images/pendulumWeb.jpg' }
I guess that I am missing something here. After having found this sample within
I'm having trouble getting a sample program to link correctly (in this case against
This is a strange problem I'm having, I've downloaded the WebSharingAppDemo sample from Microosfts
I'm having hard time with this simple ajax call function sendreq() { $.ajax({ dataType:
hey guys having this really simple problem but cant seem to figure out have
I am having trouble with this simple task: cat file | grep -E ^[0-9]+$
I'm having difficulty doing this seemingly simple task. I want to load XML files
I think this should be simple but I am having some difficulty implementing it.
I think this should be simple, but im having a real hard time finding

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.