I have this code :
Yes <input type="radio" value="txt1" name="myRadio" id="text1" checked=true />
No <input type="radio" value="txt2" name="myRadio" id="text2" />
$('#text1').change(function() {
alert('changed');
return;
});
that handler only the id=text1 (yeah, I should do this on the name). But it should works anyway. In fact it works only when I select the checkbox text1, not when I select text2.
Why? And how can I fix this?
Wrap the inputs in a div. Right now, you’re only referencing the first input.