Ronalds Vilciņš

Riga, Latvia

HTML input autofocus attribute

The <input> autofocus attribute is used to specify that the element should get focus when the page loads. When present, it specifies that an <input> element should automatically get focus when the page loads.

<input type="text" autofocus />

You can apply the autofocus attribute on <input>, <button>, <select> and <textarea>.

See also