Reputation: 2747
I have a drop down with 20 options and I like to select the 10th but I don't want it should be selected with the color blue, it should just be the one that its shown before the user is opening the dropdown list.
so basically it should still be all the options but rather then showing the first one it should be showing the 10th, and when the user will open the dropdown we will be able to see all the options.
selected="selected"
is good but its selected with a blue color, i just want it should be shoen, not with the color.
* the dropdown is shows only 1 option before the user is opening it..
Upvotes: 0
Views: 828
Reputation: 50807
I don't think you'll be able to do this with Javascript or CSS, not using the built-in controls. The various browsers allow some styling of SELECT and OPTION elements, but they are very inconsistent, and I wouldn't count on being able to use them.
But there are many libraries that work to replace your form element with ones that can be styled and keep the hidden underlying form values synchronized with them. One such library is http://www.emblematiq.com/lab/niceforms/ but there are many of them to choose from.
Upvotes: 1
Reputation: 7407
Is it the selected property you are looking for?
<select>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4" selected="selected">4</option>
<option value="5">5</option>
</select>
A jsfiddle can be found here: http://jsfiddle.net/TpuRc/
Upvotes: 1