2009/12/28, Charlie Griefer <charlie.griefer@gmail.com>:
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 <aaabbbcccdaabb@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.
--
<a href="http://www.51.la/?3143621" target="_blank"><img alt="我要啦免费统计" src="http://img.users.51.la/3143621.asp" style="border:none" /></a>
No comments:
Post a Comment