Focus, when starting the page

Asked

Viewed 1,507 times

14

How best to get an element to focus as soon as the page loads

  • 1

    You can do this directly in html with autofocus

  • but it has to be automatic, when the page caregar

  • 1

    Yes, whenever you access the page he will stay focused

1 answer

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

  • 3
  • 4

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

  • 3

    @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

You are not signed in. Login or sign up in order to post.