Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I convert Enter to Tab (with focus change) in IE9? It worked in IE8
    primarykey
    data
    text
    <p>I have a text input with an onkeydown event handler that converts &lt;Enter&gt; to &lt;Tab&gt; by changing the event's keyCode from 13 to 9.</p> <pre><code>&lt;input type="text" onkeydown="enterToTab(event);" onchange="changeEvent(this);" name="" value="" /&gt; &lt;!-- Other inputs exist as created via the DOM, but they are not sibling elements. --&gt; </code></pre> <p>Javascript:</p> <pre><code>function enterToTab(myEvent) { if (myEvent.keyCode == 13) { myEvent.keyCode = 9; } } function changeEvent(myInput) { var test = "hello"; } </code></pre> <p>In IE8, this caused the onchange event to fire, but that doesn't happen in IE9. Instead, the input field retains focus. How I can I make that happen? (It works in Firefox 3.6 and Chrome 10.0.) This even works in Browser Mode IE9 if I set the Document Mode to "IE8 standards". But it won't work with a Document Mode of "IE9 standards". (My DocType is XHTML 1.0 Transitional.)</p> <p>Since it works in IE7 &amp; 8, could this be a bug in IE9 that will get fixed?</p> <p>Please note: I <strong>cannot</strong> use <code>input.blur()</code> or <strong>manually set a new focus</strong>, which is advised by all the other solutions that I've read. I've already tried onkeypress and onkeyup with no luck. I need a generic solution that will cause the web app to literally behave as though I'd hit &lt;Tab&gt;. Also, I don't have jQuery, however, Dojo 1.5 is available to me.</p> <p>Also note: I KNOW this is "wrong" behavior, and that Enter ought to submit the form. However, my client's staff originally come from a green screen environment where Enter moves them between fields. We must retain the same UI. It is what it is.</p> <p><strong>UPDATE:</strong> I found a difference between IE8 &amp; IE9. In IE8, my setting of <code>myEvent.keyCode</code> holds. In IE9, it does NOT. I can update <code>window.event.keyCode</code>, and it will hold, but that won't affect what happens later. Argh... Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload