AttitudeMonger AttitudeMonger - 2 years ago 161
jQuery Question

Text Input focus anomaly in IE9

I am trying out this rather simple code. It is supposed to shift the focus to the neighboring text input whenever there is

on the first one:

<!DOCTYPE html>
<script src="//">
$(document).ready(function() {
$(".foo").mouseup(function() {
<input type='text' class='foo' />
<input type='text' class='boo' />

In all browsers except
(I didn't dare test it in
or below!), it works fine for both left button and right button (for right button
, the context menu still pops up on the first input even though the focus shifts to the 2nd one). However, in
, the focus still remains on the first text input (the context menu also popping up there).

Is there any way to fix it so that the focus shifts to the 2nd one?

Answer Source

.select() in ie should work:

  $('.foo').mouseup(function() {
  $('.foo').contextmenu(function() {
      return false;

Have also handled the context menu by returning false. Hope helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download