Ad Code

How to get the text after a radio button

Code:

<input type="radio" value="x" name="a" />One<br />
<input type="radio" value="y" name="b" />Two<br />
....

I have many of radio buttons like above.

How can I get text string after a radio when it has been clicked?


jQuery:

$(document).ready(function() {
    $("input[type=radio]").click(function(e) {
        var radioText = e.currentTarget.nextSibling.data
        alert(radioText);
    });
});

Post a Comment

0 Comments