I know others have run into this problem before. I have searched and tried all sorts of different solutions (including JQuery focus and JQuery Problem .... Focus not working and JQuery focus() is not focusing in IE but it is in Chrome) yet nothing has worked.
When the code runs in FF and Chrome, focus follows along as it should. However, in IE (I'm using IE9), no such luck. The focus is not placed on the input text. Any assistance would be appreciated.
// textInputArray contains the input field along with some other html with instructions
// about the input field
$("input.answerBox").live("keypress", function(event) {
if ((event.which == 13) && (i < textInputArrayLength)){
$("div.textInput").html(textInputArray[i])
.fadeIn(200);
$("input.focus:last").focus();
i++;
}
}
Again, everything works as expected in FF and Chrome, but not IE. The contents of the textInput div is replaced, but the input text box does not receive focus in IE.
Edit: html as requested
<div id="menuBar">
<ul class="dropdown">
<li class="menuLi"><a href="#" class="blank">Item 1</a>
<ul class="sub_menu">
<li class="menuLi"><a href="#" class="blank">Number</a>
<ul class="sub_sub_menu">
<li class="menuLi"><a href="/test/index.php" class="menuItem blank">Sub Item 1</a></li>
<li class="menuLi"><a href="/test/index.php" class="menuItem blank">Sub Item 2</a></li>
</ul>
</ul>
</ul>
<br>
</div>
<div id="main">
<h1 class="header1">Quick Quiz</h1>
<div class="textInput">
</div>
</div>
<div class="footer"></div>