My understanding is that the clicked radio button is always checked, unless you are doing some voodoo; thus, the only thing that's useful is the value of the checked button. The value tells you which one was clicked. This is of course assuming the radio buttons are grouped by name.

$("input:[EMAIL PROTECTED]").click(function() {
   if ( $(this).val() == 'somevalue' )
       // do something
   else
       // do something else
});

----- Original Message ----- From: "Wizzud" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Wednesday, November 28, 2007 3:10 PM
Subject: [jQuery] Re: how to know which radio button is checked?



If you filter on :checked before binding the click, what happens when
the unchecked radio is clicked?!

On Nov 28, 2:50 pm, Tim <[EMAIL PROTECTED]> wrote:
try this:

$("input:[EMAIL PROTECTED]:checked").click(function() {

 });

On Nov 28, 8:42 am, "[EMAIL PROTECTED]"

<[EMAIL PROTECTED]> wrote:
> I have two radio buttons, user can choose one of them, when it is
> clicked, it will trigger some function calls, now, how to know which
> radio button is selected at this time? thanks.

> $("input:[EMAIL PROTECTED]").click(function() {

> });

Reply via email to