the sum part works if you click each box individually but not when you click select all (although select all does check all the boxes)
any thoughts?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>jQuery Example</title>
<script src="../js/jquery.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready( function() {
$(".chkOptions").click(
function () {
var ntot = 0;
$(".chkOptions:checked").each(function () {
ntot += parseInt($(this).val());
});
$("#PaymentTotal").val(ntot);
})
.change();
});
</script>
<SCRIPT LANGUAGE="JavaScript">
$(document).ready(function()
{
$("#paradigm_all").click(function()
{
var checked_status = this.checked;
$("input[name=paradigm]").each(function()
{
this.checked = checked_status;
});
});
});
</script>
</head>
<body>
<h2>How much do you want to save?</h2>
<form id="myTable" name="test" method="post" action="">
Check this for 10% savings
<input name="paradigm" class="chkOptions" type="checkbox" value="10" checked />
<br />
Check this for 15% savings
<input name="paradigm" class="chkOptions" type="checkbox" value="15" />
<br />
Check this for 20% savings
<input name="paradigm" class="chkOptions" type="checkbox" value="20" />
<br />
Check this for 25% savings
<input name="paradigm" class="chkOptions" type="checkbox" value="25" />
<br />
Check this for 30% savings
<input name="paradigm" class="chkOptions" type="checkbox" value="30" />
<br />
<input type="checkbox" id="paradigm_all">Select All<br>
</form>
<!-- checkall(name of form, common name of checkbox group, true or false)-->
<p>Total Savings:
<input type="text" id="PaymentTotal" value="0" size="5" />
</body>
</html>