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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:09:49+00:00 2026-06-17T16:09:49+00:00

I am trying to feature detect IE’s behavior when pressing enter in an input

  • 0

I am trying to “feature detect” IE’s behavior when pressing enter in an input box that has a button element next to it (when they are not in a form element).

I’m saying IE’s behavior because no one else fires a click event on the next button when pressing the enter-key while the input is focused.

Related question where the first awnser describes why IE behaves like this:
IE bug triggers click for 2 buttons?

JS-Fiddle where I try to simulate the key press via jQuery.Event and .trigger:
http://jsfiddle.net/DbVrn/

Behavior of said js-fiddle in IE:

  • When opening the page, the input gets focus, and then we try to simulate pressing of the enter-key.
  • The simulated enter-key does nothing, hence the input remains focused and red.
  • If you manually press enter while the input is focused, the button will become focused and green.

The problem i have with my current attempt to detect this feature is that:

$("input").trigger(jQuery.Event("keypress", { which: 13 }));

does not actually do the same as manually pressing the enter-key while the input is focused.

How can I successfully simulate the enter-key so that my test for this behavior is possible?
Or is there another way i can test for this behavior?

Edit: Updated title to more clearly state that this needs to be tested via javascript, and that the test needs to work in IE from version 8 to 10. Unless anyone else can provide a way of testing this, I will conclude that I need to use user-agent sniffing to see if browser is IE and choose code-path based off that.

  • 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-17T16:09:49+00:00Added an answer on June 17, 2026 at 4:09 pm

    It seems there is no way to test for this behavior via JavaScript.
    I have tested IE 8, 9 and 10 and confirmed they all behave this way.

    So for now, i am going to combine some ideas from
    Javascript IE detection, why not use simple conditional comments? and
    http://tanalin.com/en/articles/ie-version-js/ to create a test for IE that will work reliably as long as IE does not remove support for conditional compilation comments.

    var ie = (/*@cc_on!@*/false && (function(){
        var div = document.createElement("div"),
            list = div.getElementsByTagName("br"),
            version = 3;
        do {
            div.innerHTML = "<!--[if gt IE " + (++version) + "]><br><![endif]-->";
        } while(list[0]);
        return (version > 4 ? version : 10);
    }()));
    

    The ie variable will be the browser version in Internet Explorer, and will be false in other browsers.

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

Sidebar

Related Questions

I'm trying to use a feature of the Microsoft WinHttp library that has been
I'm trying to add a feature to my app that will post a status
i'm trying to find a good way to detect if a feature exists before
I'm trying to detect the distance the mouse has moved, in pixels. I am
I'm trying to implement undo/redo feature in my custom application that displays code using
im trying to create a sort of playlist feature that will work on the
Trying to honor a feature request from our customers, I'd like that my application,
I'm trying to use the input-append feature of Twitter Bootstrap. However, I want to
I am trying the GeoLocation feature in HTML5. I have tried this for example:
When trying to rebase a feature branch onto master, I get the following error:

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.