Calculate values from multiple checkboxes and one textbox
Hello
I need help with this code. I am beginner.
My platform PHP, MySQL. I am not very familiar with Javascript.
I need to calculate value of each Checkbox List (Price) plus value from one TextBox (PrixBase)
I have found this JQuery which works great in my case, but it make append two numbers instead calcul addition
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript">
<!--//--><![CDATA[//>
<!-- $(document).ready( function() {
$(".chkOptions").click(
function () {
var ntot = document.getElementById('PrixBase').value; $(".chkOptions:checked").each(function () {
ntot += parseInt($(this).val());
});
$("#txtTotalOptions").val(ntot);
})
.change();
});
//--><!]]> </script>
This code works very well, it makes sum of each checkbox with class="checkbox", but only if i put value ntot = 0. I want to assign certain value to ntot from one textbox.
Can you help me to modify this code to make sum (all checkboxes + one textbox)
Example page at
Options calculation Thank you very much