0

Is there any attribute for select tag in HTML like autoFocus for textbox ? So that select should have default focused. Means I want to do autofocus for select tag.

JavaScript Linq
  • 2,605
  • 3
  • 13
  • 12
  • Possible duplicate of http://stackoverflow.com/questions/4166423/default-html-form-focus-without-javascript. – Anders Aug 21 '15 at 09:47

1 Answers1

1

You can use autofocus in the select tag as follows:

<select autofocus>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

If you run the code snippet and then immediately press enter or the down arrow then you will see that the select has the focus on the page. Is this what you wanted?

tombarti
  • 426
  • 2
  • 8