How do I preselect in a drop down list box? [duplicate]
I am trying to preselect like this:
<option selected="yes" value="test1" &g开发者_开发技巧t;test1</option
But I get a message in VS2010 saying "Validation HTML5: The value permitted for this attribute do not include 'yes'.
Am I doing something wrong. I thought the way to preselect was as above.
it should be selected="selected"
<option selected="selected" value="test1" >test1</option>
Selected attribute only contain selected value, like this:
<option selected="selected" value="test1">test1</option>
<option selected="selected">test1</option>
Would be the correct way to do it, AFAIK.
try selected="selected"
or you can just leave the selected without any value like <option selected>test1</option>
精彩评论