-1

How to make options in select HTML as a main viewer.

My mean is, if this code

<select>
    <option>one</option>
    <option>two</option>
    <option>three</option>
    <option>four</option>
    <option>five</option>
</select>

Run, it will show one when user didn't click that select button yet, but how can I make four as a main without changing the place of that arrangement..

I hope you all understand what I mean..

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Mohd Shahril
  • 2,257
  • 5
  • 25
  • 30

3 Answers3

6

Try this :

<select>
    <option>one</option>
    <option>two</option>
    <option>three</option>
    <option selected="selected">four</option>
    <option>five</option>
</select>
Prasanth Bendra
  • 31,145
  • 9
  • 53
  • 73
0

try this if you want to show four as selected

<select>
    <option>one</option>
    <option>two</option>
    <option>three</option>
    <option selected="selected">four</option>
    <option>five</option>
</select>

or

<select>
    <option>one</option>
    <option>two</option>
    <option>three</option>
    <option selected>four</option>
    <option>five</option>
</select>
0

simply use selected attribute which you want to select and others leave as it is.

<option selected="selected">four</option>
Tapas Pal
  • 7,073
  • 8
  • 39
  • 86