Sometimes, we want to make a placeholder for a select box with HTML.
In this article, we’ll look at how to make a placeholder for a select box with HTML.
How to make a placeholder for a select box with HTML?
To make a placeholder for a select box with HTML, we add a disabled option into the drop down.
For instance, we write
<label
>Option name
<select>
<option value="" disabled selected>Select your option</option>
<option value="hurr">Durr</option>
</select>
</label>
to add a disabled option as the first option.
We make it selected by default with the selected attribute.
Conclusion
To make a placeholder for a select box with HTML, we add a disabled option into the drop down.