+ 1
Autofocus
I don't understand why autofocus is usefull... Some help please!
4 Respostas
+ 5
To add to what Scooby said...
Autofocus can be very useful when you want to direct the eyes of the user to a specific element upon page load... Not too long ago I wrote a code that had two input fields. The first field was for the user to put in a text; the second was where the text of the user was displayed after the program had removed some unwanted characters.
Obviously, I wanted the user to automatically know without much thinking or searching where he should input his text. So I used autofocus on the first input field.
+ 6
Definition and Usage. The autofocus attribute is a boolean attribute. When present, it specifies that an <input> element should automatically get focus when the page loads.
The autocomplete attribute specifies whether a form should have autocomplete on or off. When autocomplete is on, the browser automatically complete values based on values that the user has entered before. Tip: It is possible to have autocomplete "on" for the form, and "off" for specific input fields, or vice versa.
+ 2
ok thanks ! Can u send me this code, to see how it looks like?
+ 2
Sure. Here. I wrote it on May the 8th but I made a few changes just now, that is why it says that it was done today.
Another note: the autofocus is being weird on the first page load; it doesn't focus on the field but it does on subsequent page the next times you run the code. Still not sure why. Stack Overflow hasn't been very helpful on that...
https://code.sololearn.com/WbzEMARxL4Gf/?ref=app