// Set the second one to the selected status
// If (<% = rows ["sex"] % >== "2") {$ (': radio [name = sex]'). eq (1 ). attr ('checked', true );}
// Set the value to 2 as the selected status.
// If (<% = rows ["sex"]. toString () % >== '2') {$ ("input [name = 'sex']"). attr ("checked", '2 ');}
If (<% = rows ["sex"] % >== "2") {$ ("input [name = sex] [value = 2]"). attr ("checked", true );}
Today, I did something about NB. The above three conditions have all been tested to be of great significance. Is it because the local database has been operating remotely?
JQuery gets radio
Copy codeThe Code is 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>