<style>#docContainer #item9{display:none;}
</style><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">$(document).ready(function(){
//The inputs you want read only and the sumtotal class set to
$('input[name="text1"]').attr('readonly', true);//
name of item 1 subtotal $
$('input[name="text1"]').addClass('sumtotal');
$('input[name="text2"]').attr('readonly', true);//
name of item 2 subtotal $
$('input[name="text2"]').addClass('sumtotal');
$('input[name="grandtotal"]').attr('readonly',
true);// name of grand total $
// name of amount of item 1
$('input[name="item1amount"]').bind('keyup keypress
click blur',function(){
var valone = $('input[name="item1amount"]').val();
var valtwo = 13.00;
var total1 = ((valone * valtwo));
if(valone > 0){
$('input[name="text1"]').val(total1.toFixed(2)); //
cost sub total of item 1
calculateSum();
}else if (valone == ""){
$('input[name="text1"]').val("");
}
if ($('input[name="item1amount"]').val()== ""
&& $('input[name="item2amount"]').val()==""){
$('input[name="grandtotal"]').val("");
}
});
// name of amount of item 2
$('input[name="item2amount"]').bind('keyup keypress
click blur',function(){
var valone = $('input[name="item2amount"]').val();
var valtwo = 22.00;
var total2 = ((valone * valtwo));
if(valone > 0){
$('input[name="text2"]').val(total2.toFixed(2)); //
cost sub total of item 2
calculateSum();
}else if (valone == "" ){
$('input[name="text2"]').val("");
}
if ($('input[name="item1amount"]').val()== ""
|| $('input[name="item2amount"]').val()==""){
calculateSum();
}
});
function calculateSum() {
var sum = 0;
$('.sumtotal').each(function() {
var text = $(this).val().replace("$", "");
$(this).val(text);
//console.log($(this).val());
if(this.value!="" && this.value.length!=0) {
sum += parseFloat(this.value);
$(this).val("$" + $(this).val());
}
});
$('input[name="grandtotal"]').val("$"+sum.toFixed(2));
// grand total
$('input[name="actual_grandtotal"]').val(sum.toFixed(2));
// actual grand total
}
});</script>