Radio Group Radio: $ ("input[@type =radio][@checked]"). Val ();
Single-select group radio: $ ("input[@type =radio]"). attr ("Checked", ' 2 ');//Set value=2 project is currently selected
Gets the value of a set of radio selected items
var item = $ (' input[@name =items][@checked] '). Val ();
Radio the second element of a radio group is the currently selected value
$ (' input[@name =items] '). Get (1). Checked = True
Single-select group radio: $ ("input[@type =radio]"). attr ("Checked", ' 2 ');//Set value=2 project is currently selected
The old version of jquery
Var_name = $ ("input[@name = ' radio_name ']:checked"). Val ();
Later versions of jquery 1.3
Var_name = $ ("input[name= ' Radio_name ']:checked"). Val ();
Look at a jquery instance that gets the radio value
function Getra () {
Var_name = $ ("input[name= ' isspecialcnt ']:checked"). Val ();
alert (var_name);
if (var_name== ' 1 ') {
$ ("#isspecialcntyes"). Show ();
$ ("#isspecialcntno"). Hide ();
}
if (var_name== ' 0 ') {
$ ("#isspecialcntyes"). Hide ();
$ ("#isspecialcntno"). Show ();
}
}
<form name= "Form1" method= "Post" action= "" >
<p>
<label>
<input type= "Radio" name= "Radiogroup1" value= "Radio" id= "RADIOGROUP1_0" >
Radio </label>
<br>
<label>
<input type= "Radio" name= "Radiogroup1" value= "Radio" id= "Radiogroup1_1" >
Radio </label>
<br>
<label>
<input type= "Radio" name= "Radiogroup1" value= "Radio" id= "Radiogroup1_2" >
Radio </label>
<br>
<label>
<input type= "Radio" name= "Radiogroup1" value= "Radio" id= "Radiogroup1_3" >
Radio </label>
<br>
<label>
<input type= "Radio" name= "Radiogroup1" value= "Radio" id= "Radiogroup1_4" >
Radio </label>
<br>
<label>
<input type= "Radio" name= "Radiogroup1" value= "Radio" id= "Radiogroup1_5" >
Radio </label>
<br>
</p>
</form>