Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A jQuery plugin to enable cross-browser usage of the HTML5 autofocus property.
branch: master

Changed attribute-equals selector to has-attribute.

The existence of the attribute needs to be
verified, not its contents. Using the has-
attribute selector will allow all of the following
uses to work, where formerly only the first one

	<input autofocus>
	<input autofocus="autofocus" />
	<input autofocus="true">

This obviously does not change any functionality
in the plugin, but points the user in a better
direction and may avoid confusion if a user
happens to employ one of the latter two methods.
latest commit d6ae71b7a0
@benspaulding benspaulding authored


HTML5 autofocus plugin v0.2*
Copyright (c) 2009, Mike Taylor,
MIT Licensed:

NOTE: As per the spec, only one element is permitted to have the
autofocus attribute, hence no .each()

USAGE: $("[autofocus]").autofocus();

Thanks to paul_irish and temp01 for feedback and improvement suggestions.
Something went wrong with that request. Please try again.