Select empty without appearing in the list

Asked

Viewed 733 times

0

all good?

I have some questions about the HTML tag select. Could you put it without a preselected option without it appearing in the list? all the examples I found there is always at least one item in the list appearing, or "select an option" and this shows this message in the list, would have to leave empty without appearing in the list?

Example of w3schools

  • create an empty item instead of "select an option", this does not resolve?

1 answer

0


If you leave a blank option it is empty

We can see using the very example of w3schools

The directive disabled prevents you from selecting the void and the selected leaves him pre-selected

<select>
  <option value="" data-default disabled selected></option>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>

  • More or less, it just has that kind of approach?

  • @Andrefirmo is the way I know.

Browser other questions tagged

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