14
How best to get an element to focus as soon as the page loads
14
How best to get an element to focus as soon as the page loads
13
You can use an html resource called autofocus
<input autofocus type="text" name="Com Foco" placeholder="Com foco">
<input type="text" name"Sem foco" placeholder="Sem foco">
@Brunocosta 80% is a good margin, don’t you think? Especially considering that the unsupported ones are Opera Mini (does anyone use this? ) and Safari for iOS (okay, there are plenty of people who use).
@jbueno What I think is that browsers should make the effort to support all the features so that we are not worried about these things. If you see otherwise 1 in 5 people will not have the desired behavior.
Browser other questions tagged html input
You are not signed in. Login or sign up in order to post.
You can do this directly in html with autofocus
– Felipe Paetzold
but it has to be automatic, when the page caregar
– Murilo Melo
Yes, whenever you access the page he will stay focused
– Felipe Paetzold