Ronalds Vilciņš

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>.

This site is ad-free and doesn’t use trackers. If you’d like to support my writing, I’d love if you could buy me a coffee.