How to add blank HTML select without blank item in dropdown list?

Spread the love

Sometimes, we want to add blank HTML select without blank item in dropdown list.

In this article, we’ll look at how to add blank HTML select without blank item in dropdown list.

How to add blank HTML select without blank item in dropdown list?

To add blank HTML select without blank item in dropdown list, we add a disabled option.

For instance, we write

<option selected disabled hidden style="display: none" value=""></option>

to add the disabled attribute to add the disabled option.

Then we hide it with display: none.

Conclusion

To add blank HTML select without blank item in dropdown list, we add a disabled option.

Leave a Reply

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