Skip to content

Instantly share code, notes, and snippets.

Created September 23, 2011 00:55
What would you like to do?
HTML5 Autofocus Polyfill using jQuery
(function ($) {
$(function () {
if (!supportsInputAttribute('autofocus')) {
$('[autofocus=]').focus(); //
// detect support for input attirbute
function supportsInputAttribute (attr) {
var input = document.createElement('input');
return attr in input;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment