jp19 25


I am working on a site where to measure sports popularity, there is a poll with an HTML select menu, where users can vote for their top favorite sport with options say "Cricket, Football, Basketball".

Now, when the user visits the page, the menu is shown, with "Sport1" selected/written by default. I know I can change it to any default SportN..

However, I want some plain text to appear. Like "Choose Your Favorite Sport". Which will not be an 'option' but just a text to show by default instead of an actual sport name. How can I do this?

In the given example - I can select any Sport to be shown by default in the menu. However, I want "Choose One" text to be shown instead of the option.

thanks JP

1 answer

This was chosen as the best answer

You would add the option and not assign it a value like this:

<select name="myDropDown">
     <option value="" selected>Choose one: </option>
     <option value="/webpage1.html">Menu item 1</option>
     <option value="/webpage2.html">Menu item 2</option>
     <option value="/webpage3.html">Menu item 3</option>
Answered about 8 years ago by Artistic Abode
  • Doing this will require some form validation because they are able to choose the first menu item. But this is how it is done most often. Ktash about 8 years ago
  • You can also add the "disabled" attribute to the element so it cannot be selected again, once another selection has been made. <option value="" selected disabled>Choose one:</option> Gary Hepting over 6 years ago