1. To get the selected value, three methods are available:
$ (' input:radio:checked '). Val ();
$ ("input[type= ' Radio ']:checked"). Val ();
$ ("Input[name= ' rd ']:checked"). Val ();
2. Set the first radio to the selected value:
$ (' Input:radio:first '). attr (' checked ', ' checked ');
Or
$ (' Input:radio:first '). attr (' checked ', ' true ');
Note: attr ("Checked", ' checked ') = attr ("Checked", ' true ') = attr ("Checked", true)
3. Set the last radio as the selected value:
$ (' Input:radio:last '). attr (' checked ', ' checked ');
Or
$ (' Input:radio:last '). attr (' checked ', ' true ');
4. Set any one of the radio to the selected value according to the index value:
$ (' Input:radio '). EQ (index value). attr (' checked ', ' true '); index value =0,1,2 ....
Or
$ (' Input:radio '). Slice. attr (' checked ', ' true ');
5. Set Radio to the selected value based on value
$ ("input:radio[value= ' Rd2 ')"). attr (' checked ', ' true ');
Or
$ ("input[value= ' Rd2 ')"). attr (' checked ', ' true ');
6. Remove Radio with value Rd2
$ ("input:radio[value= ' Rd2 ')". Remove ();
7. Delete the first few radio
$ ("Input:radio"). EQ (index value). Remove (); index value =0,1,2 ....
such as removing the 3rd radio:$ ("Input:radio"). EQ (2). Remove ();
8. Traverse Radio
$ (' Input:radio '). each (function (Index,domele) {
Write code
});
Value Assignment of checkbox, RadioButton, DropDownList in Jquery