0

I'. developing for IE9 and the HTML5 autofocus keyword which puts the cursor in the specified input field doesn't work. How can I add that functionality in IE9 (IE11 but forced down to IE9)?


The following won't work:

  • $('input').focus()

  • $(function() {$('[autofocus]:not(:focus)').eq(0).focus();});

  • setTimeout(function() { document.getElementById('myInput').focus(); }, 10);


As suggested:

HTML

<body>
<form>
    <h3>Find Item</h3>
    <input maxlength="8" name="abcd" id="abcd" autofocus="autofocus" placeholder="Find Item" required>
</form>

JS

<script>
   $(document).ready(function(){
      $("#wordOrderID").focus();
   }
</script>
Heraclitus
  • 80
  • 11

1 Answers1

0

Checked JS console and was surprised to see an error even tho my code in that page is 10 lines long. Removed problematic code and $('input').focus(); works!

Heraclitus
  • 80
  • 11