DEV Community

Cover image for How to add a placeholder on a select
Sara Ounissi
Sara Ounissi

Posted on • Originally published at thetrendycoder.com

How to add a placeholder on a select

It is quite easy to add a placeholder on a select in HTML, you just need to add an option with the text you need as a placeholder. The only thing to look for is to empty the value, add the two properties selected and disabled.

<select> 
    <option value="" disabled selected>Select your option</option>
    <option value="test">Test</option>
</select>
Enter fullscreen mode Exit fullscreen mode

Discussion (0)