autofocus | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

autofocus

hello! how to put autofocus on textbox in html? thanks

22nd Dec 2016, 4:43 PM
Mauro Cuccomarino
Mauro Cuccomarino - avatar
1 Answer
+ 2
Simply put the "autofocus" keyword in one <input> tag: <input type="textbox" autofocus> Not tested behaviour in case of multiple elements with autofocus ( not logical: autofocus define focus on load, and focus cannot be set on multiple elements )... WARNING: autofocus attribute is only valid in html5, so require an html5 doctype ^^
22nd Dec 2016, 10:57 PM
visph
visph - avatar