How do I detect than any one of group of radio buttons are clicked?
I have a group of radiobuttons:
<input type="radio" name="group1" value="1" />1
<input type="radio" name="group1" value="2" />2
<input type="radio" name="group1" value="3" />3
<input type="radio" name="group1" value="4" />4
<input type="radio" name="group1" value="5" />5
I want to detect when the user clicks on any one of them. It does not matter which. So I tried the following, which does not work:
$('input[name=group1]').click(function () {
$("#textmsg").show();
});
Is there something wrong with the code?
(A separate issue is that I have code that clears the radiobuttons: $("input:radio").attr("checked", false);
and I'm hoping that this would NOT fire the click event.
Thanks.