Created
August 2, 2011 00:38
-
-
Save nzakas/1119343 to your computer and use it in GitHub Desktop.
Autofocus shim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- autofocus shim for older browsers that doesn't impact newer ones --> | |
<input type="text" name="q" id="q" autofocus> | |
<script> | |
(function(textbox){ | |
if (textbox.autofocus !== true){ | |
textbox.focus(); | |
} | |
})(document.getElementById("q")); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment