Thursday, August 3, 2017

How to remove first option from select drop down option value

We may get a task sometime to remove the first value from the drop down like Chosse Country, Empty option, --Select-- etc.,

We can have lot of option to remove this. But here we can use simple css style option. Let see the code.

<select name="test">
    <option value="" style="display: none"></option>
    <option value="">Option 2</option>
    <option value="">Option 3</option>
    <option value="">Option 4</option>
    <option value="">Option 5</option>
  </select>

The style:display:none do the job for you!

1 comment:

  1. Thanks for sharing this post. Really useful for me to understand Reactjs. http://zenrays.com/reactjs-training-in-bangalore

    ReplyDelete