yohannan_sobin
yohannan_sobin

Reputation: 917

Radio button value

I have a dynamically generated radio button as fiven below

echo '<tr>
                            <td colspan="2">Login System</td>
                            <td colpan="2">
                                <input type="radio" name="login_system'.$i.'" value="COMMON" checked="checked" />Common &nbsp
                                 <input type="radio" name="login_system'.$i.'" value="INDIVIDUAL">Individual
                            </td>
                        </tr>';

and i need to take its value using javascript. Below is the code i have written for that

d['login_system']=$('input[name="login_system'+index+'"]').val();

But always I am getting value of first radio button even if I have selected second. Can anyone help me?

Upvotes: 0

Views: 148

Answers (1)

Quentin
Quentin

Reputation: 944529

$('input[name="login_system'+index+'"]:checked').val()

Upvotes: 1

Related Questions