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 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.

Reply via email to