Can someone explain the work of autofocus in html course | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can someone explain the work of autofocus in html course

18th Nov 2019, 10:31 PM
prosper muziya
prosper muziya - avatar
3 Answers
+ 3
The element with focus is the one which will get updated with user input.
19th Nov 2019, 12:18 AM
Sonic
Sonic - avatar
+ 2
It basically puts a cursor on the input element so the user doesn't have to click on it before typing when the page loads.
19th Nov 2019, 11:45 AM
Prince Asiedu
Prince Asiedu - avatar
+ 1
The use of the"autofocus" attribute is to have the element onto which it is applied gets focus as soon as a page loads. It saves the little trouble of having to move your mouse over form elements and clicking on em before input. It can also be applied to one element as many elements cannot receive focus at the same time
19th Nov 2019, 5:25 AM
Hayzeed