Check radio button using Jquery

by satheeshkumar 2014-07-28 18:01:22

Check radio button using Jquery,

Check the radio button for all the radio buttons having same name without referring id,
 
HTML :
<input type='radio' name='chk_radio'> Yes
<input type='radio' name='chk_radio'> No

By Using Jquery you can check radio button using the same name,

$('input:radio[name=chk_radio]:nth(0)').attr('checked',true); //To check first radio button 

$('input:radio[name=chk_radio]:nth(1)').attr('checked',true); //To check second radio button
​
Here nth(0) and nth(1) refers first and second radio button to be checked with the name 'chk_radio'.
1470
like
0
dislike
0
mail
flag

You must LOGIN to add comments