1

I asked this question about how to make elements like div element get focus, and the answer there really helped me a lot. But I can't make IE8 understand about it. I don't know what's wrong here. My method is to use tabindex='x' on my div element and then through jQuery, set in under focus using $('#divId').focus(). This works like a charm in ALL browsers, but fails to respond in IE8 (no bug, just doesn't work).

Anyone has any idea? Thanks

Community
  • 1
  • 1
Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188
  • Have you tried the fiddle I posted in my answer to the other question? I just tried it in IE8 and it seems to work fine to me! – James Allardice Jul 09 '11 at 12:23
  • Actually I saw that, but in my test environment I use IE9, but rendered in IE8 compatibility view. Could it be the problem? I tested your fiddle in this environment and it worked. I'm really puzzled here :) – Saeed Neamati Jul 09 '11 at 12:31
  • 1
    No, the IE8 tool in IE9 should be fine, I've tried it in that and it works fine. The chances are it's something to do with your other code... do you have any other JS acting on the `div`? What styles are applied to it? – James Allardice Jul 09 '11 at 12:35
  • Well, I couldn't figure out what was the source of the problem. I just had to sniff the browser, and in case of IE8, inject a false form element to my div element, set its visibility to hidden and set focus on that. I used conditional compiling. Thanks @James. Your help is really appreciated. – Saeed Neamati Jul 09 '11 at 13:02
  • Sounds like that should work ok! No problem, glad I could be of help. – James Allardice Jul 09 '11 at 13:05

0 Answers0