How to add an HTML select option separator?

Spread the love

Sometimes, we want to add an HTML select option separator.

In this article, we’ll look at how to add an HTML select option separator.

How to add an HTML select option separator?

To add an HTML select option separator, we add a disabled option.

For instance, we write

<select>
  <option>First</option>
  <option disabled>──────────</option>
  <option>Second</option>
  <option>Third</option>
</select>

to add a disabled option and use it as a separator.

Conclusion

To add an HTML select option separator, we add a disabled option.

Leave a Reply

Your email address will not be published. Required fields are marked *