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

The Archive Base Latest Questions

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

http://jsfiddle.net/rFEER/ <select id=users> <option value=1>jack</option> <option value=2>brill</option> <option value=3>antony</option> </select>​ js: $(#users).change(function(){ alert($(this).val()); })​

  • 0

http://jsfiddle.net/rFEER/

<select id="users">
<option value="1">jack</option>
<option value="2">brill</option>
<option value="3">antony</option>
</select>​

js:

$("#users").change(function(){
    alert($(this).val());
})​

why change event not fired when using (keyup/keydown) until mouse is clicked

  • 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-31T20:51:32+00:00Added an answer on May 31, 2026 at 8:51 pm

    why change event not fired when using (keyup/keydown) until mouse is clicked

    It also fires when focus leaves the select. That’s just how the change event works.

    If you want proactive notification, you have to watch for change and keydown (at least, you may want click as well) and handle the case of getting an event when the value hasn’t actually changed, and you have to handle the fact that some of those events (keydown, for instance) are fired before the value is changed, so you have to wait a moment before processing the event. Or see SpYk3HH’s answer which uses keyup instead — that will be less proactive (not updating until key release, which could be desireable), but then you don’t need the delay (setTimeout) my code below has.

    Example (live copy):

    HTML (I took the liberty of changing the values so it was clearer which went with each name):

    <select id="users">
    <option value="j">jack</option>
    <option value="b">brill</option>
    <option value="a">antony</option>
    </select>​
    

    JavaScript:

    $("#users").bind("keydown change", function(){
        var box = $(this);
        setTimeout(function() {
            display(box.val());
        }, 0);
    });
    

    Note in 2016: bind has largely been replaced with on. In the above it you’d literally just replace “bind” with “on”.

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

Sidebar

Related Questions

http://jsfiddle.net/FYtJH/1 The filtering select needs to warn users that they're about to change the
http://jsfiddle.net/9BCrs/5/ I have this set up to load a file into a DIV using
http://jsfiddle.net/fJkBU/1/ That's my code. Basically, I have an iFrame whose source may change. I
Please refer to http://jsfiddle.net/7FfMd/6/ run the code, then select E from the drop down,
Please refer to this: http://jsfiddle.net/k8c7w/ I am trying to get the middle grey band
http://jsfiddle.net/AndyMP/nUhhf/1/ This is a simplified situation where I have a DIV that animates downwards
http://jsfiddle.net/yxhzU/1042/ I'm trying to modify this example so that within the top carousel you
http://jsfiddle.net/3NRsd/ var foo = $(div).bind(click, function() { $(div).animate({height : 500px}, 2000); $(div).animate({height : 50px},
http://jsfiddle.net/vzBZB/5/ (function(){ var i = 1; var start = true; setInterval(function(){ if (i>0&&start){ var
http://jsfiddle.net/JamesKyle/y7hBQ/ I'm making a simple jquery counting function that adds the following classes: First

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.