You don't need to use the "change" event. The "click" event is also
triggered by the keyboard. When the checkbox has focus, press the
spacebar and see what happens.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Dec 27, 2009, at 11:26 PM, Charlie Griefer wrote:
Wow. Never even thought about that, but it makes perfect sense.
Thanks for pointing that out :)
On Sun, Dec 27, 2009 at 5:52 PM, Ami <aminad...@gmail.com> wrote:
I recommend to use "change" event and not "click" event, becuase users
can change the checkbox without clicking (by using the keyboard).
On Dec 28, 1:17 am, Charlie Griefer <charlie.grie...@gmail.com> wrote:
> You just want the value of the one that's checked?
>
> $(':checkbox[name=number]').click(function() {
> if ($(this).is(':checked')) alert($(this).val());
>
> });
>
> if you want the total of all checked boxes when one is clicked:
> <script type="text/javascript">
> $(document).ready(function() {
> $(':checkbox[name=number]').click(function() {
> var total = 0;
> $(':checkbox[name=number]:checked').each(function() {
> total += parseFloat($(this).val());
> });
> alert(total);
> });
> });
> </script>
>
> On Sun, Dec 27, 2009 at 1:08 PM, dziobacz
<aaabbbcccda...@gmail.com> wrote:
> > I have:
>
> > <input type="checkbox" checked="checked" value="2" name="number"/>
> > <input type="checkbox" value="7" name="number"/>
> > <input type="checkbox" value="34" name="number"/>
>
> > I would like to get value each time when one of these checkboxes
will
> > change status, how can I do that ? For example when first checkbox
> > will be unchecked or second will be checked. Could You help me ?
>
> --
> Charlie Grieferhttp://charlie.griefer.com/
>
> I have failed as much as I have succeeded. But I love my life. I
love my
> wife. And I wish you my kind of success.
--
Charlie Griefer
http://charlie.griefer.com/
I have failed as much as I have succeeded. But I love my life. I
love my wife. And I wish you my kind of success.