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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:55:39+00:00 2026-05-16T05:55:39+00:00

I have been investigating event fire order between browsers, because our application is experiencing

  • 0

I have been investigating event fire order between browsers, because our application is experiencing some unusual behaviour.

I have created a little test to see the order of the three events: change, keydown, and keypress.

Here is the HTML (test.html):

<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
        <script src="test.js"></script>
    </head>
    <body>

        <input type="text" id="TextBox" />
        <input type="button" id="Button" value="Clear Results"/>

        <hr />

        <table id="ResultTable" style="width: 100px">
            <tr><th>Results</th></tr>
        </table>
    </body>

</html>

Here is the JS (test.js):

/*
    Appends event information to display table.
*/

$(document).ready(function() {
    $("#TextBox").change(function() {
        $("<tr><td>Change</td></tr>").appendTo("#ResultTable");
    });

    $("#TextBox").keydown(function() {
        $("<tr><td>Key down</td></tr>").appendTo("#ResultTable");
    });

    $("#TextBox").keypress(function() {
        $("<tr><td>Key press</td></tr>").appendTo("#ResultTable");
    });

    $("#Button").click(function() {
        $("#ResultTable").empty();
        $("<tr><th>Results</th></tr>").appendTo("#ResultTable");
    });
});

When I type letter f into the textbox, then press enter, I get the following in Internet Explorer 8:

Results

  • Key down
  • Key press
  • Change
  • Key down
  • Key press

But in Firefox (3.6.8), I get the following:

Results

  • Key down
  • Key press
  • Key down
  • Key press
  • Change

The order of the change event is significant as we are capturing the enter key in the keydown event, but doing some validation with the change event.

I have had a look around, but haven’t been able to identify where the issue is.
Is this expected behaviour?
Should all browsers fire jQuery events in a specified order?
Or should we remove all assumptions for order of event firing?
Or is there something else that is getting in the way I am not thinking about?

  • 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-16T05:55:40+00:00Added an answer on May 16, 2026 at 5:55 am

    I could not find anything in detail on the net about this specific scenario, other than that event order is not something that should be assumed in the implementation of browsers.

    This leads me to remove the assumption that the change method will always come after onkeydown, and will have to design my validation/submit process with this consideration.

    Basically I will move validation/submit into one method, and call it from both events, but make sure it is only called once, using a flag.

    If anyone has any extra info/advice on this that would be great. 🙂

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

Sidebar

Related Questions

I have been investigating for some time now a way to prevent my user
I've been investigating frame breaking code recently and have come across some really bizarre
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
I have been looking into IKVMing Apache's FOP project to use with our .NET
I have an application that uses MSWord automation to edit some documents, after they
I have been investigating building web parts for sharepoint 2010 and currently have a
I have recently been doing a bit of investigation into the different types of
Have been looking at the MVC storefront and see that IQueryable is returned from
Have been studying the file system related classes of Adobe AIR 1.5, but so
We have been using CruiseControl for quite a while with NUnit and NAnt. For

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.