html代码如下:
1
2
3
4
5
6
7
|
< select id = "category" name = "category" > < option value = "" >请选择类别</ option > < option value = "1" >类别1</ option > < option value = "2" >类别2</ option > < option value = "3" >类别3</ option > < option value = "4" >类别4</ option > </ select > |
js代码:
1
2
3
|
<script type= "text/javascript" > $( '#category option[value=3]' ).attr( 'selected' , true ); </script> |