jQuery focus() sometimes not working in IE8

I had a similar problem with my app, but I can’t reproduce the focus problem with your code. My problem was slightly different in that my page had a link hash that made IE not give my element focus.

Anyway, to get around the problem I added a timeout:

setTimeout(function () {
  $('.my-thing').focus();
}, 100);

Not noticeable by a user but it gives IE a moment to breathe.

Leave a Comment