JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" autofocus/>
<input type="text" autofocus="autofocus"/>
<input type="text"/>

JavaScript

// In IE7, it seems like the 'has attribute' selector isn't working. Both of the output lines
// should return '2', but in IE7 they both return '3'
$('body').append('<br/>');
$('body').append('$("input[autofocus]").length=' + $("input[autofocus]").length);
$('body').append('<br/>');

var autofocusInputs = $("input").filter(function() {
    var attr = $(this).attr("autofocus");
    return attr || attr === "" || attr === "autofocus"
});

$('body').append('elements with autofocus attribute (using filter): ' + autofocusInputs.length);