Set the second check state
if (<%=rows["Sex"]%>== "2") {$ (': Radio[name=sex] '). EQ (1). attr (' checked ', true);}
The design value=2 is selected
if (<%=rows["sex"]. ToString ()%>== ' 2 ') {$ ("input[name= ' sex ']"). attr ("Checked", ' 2 ');}
if (<%=rows["Sex"]%>== "2") {$ ("input[name=sex][value=2]"). attr ("Checked", true);
I did a NB thing today. All three of these conditions are tested and do not work because the local database has been operating at the remote database
JQuery gets Radio
Copy Code code as follows:
<div>
<input id= "Radio1" type= "Radio" Name= "Rad" value= "1" checked/>1
<input id= "Radio2" type= "Radio" Name= "Rad" value= "2"/>2
<input id= "Radio3" type= "Radio" Name= "Rad" value= "3"/>3
<input id= "Radio4" type= "Radio" Name= "Rad" value= "4"/>4
<input id= "Radio5" type= "Radio" Name= "Rad" value= "5"/>5
<input id= "Button1" type= "button" value= "button" onclick= "Return Button1_onclick ()"/>
<input id= "Button2" type= "button" value= "button" onclick= "Return Button2_onclick ()"/>
</div>
<script language= "javascript" type= "Text/javascript" >
<! [cdata[
function Button1_onclick () {
$ ("input"). each (function () {
if (This.type = = ' Radio ') {
Alert ($ (this). Val ());
}
});
}
function Button2_onclick () {
Alert ($ ("input[@type =radio]:checked"). Val ());
Alert ($ ("Input[name= ' rad ']:checked"). Val ());
Alert ($ ("input[@type =radio]"). Val ());
}
]]>
</script>