I am running the following code: The first two little functions work because I am using the jquery calculate plugin… the last 3 fail in Firefox and Safari but work in Chrome
<script type="text/javascript">
$(document).ready(function() {
$("input[id^='balance']").sum("keyup", "#totalbalance");
$("input[id^='payment']").sum("keyup", "#totalpayment");
$('input.ltv1, input.ltv2').click(function() {
var ltv1 = parseFloat($('.ltv1').val()||"0");
var ltv2 = parseFloat($('.ltv2').val()||"0");
result = ltv2/ltv1;
total = parseInt(result);
$('.ltv').text(total);
});
$('input.bal1, input.bal2, input.bal3, input.ltv2').change(function() {
var bal1 = parseFloat($('.bal1').val() || "0");
var bal2 = parseFloat($('.bal2').val() || "0");
var bal3 = parseFloat($('.bal3').val() || "0");
var bal = bal1 + bal2 + bal3
var hv = parseFloat($('.ltv2').val() || "0");
result = bal / hv;
total = parseInt(result);
$('.clv').text(total);
});
$('input.bal1, input.bal2, input.bal3, input.income').change(function() {
var bal1 = parseFloat($('.bal1').val() || "0");
var bal2 = parseFloat($('.bal2').val() || "0");
var bal3 = parseFloat($('.bal3').val() || "0");
var bal = bal1 + bal2 + bal3
var income = parseFloat($('.income').val() || "0");
result = bal / income;
total = parseInt(result);
$('.dti').text(total);
});
});
</script>
I am not the best at javascript so I have pieced this together…
Anyway the site is http://settlementprep.com/pre-qual/homeowner/ and the little boxes show the different calculations: Loan to Value and Combined Loan to Mortgage don’t work..
Anyone have a clue?
thanks
In your javascript, I see this:
But, in your page, I don’t see any object with a
class="ltv". I see this HTML:which would imply your javascript code should be this instead:
The same appears to be true for
.clv. Code and HTML don’t match.FYI, I also see undeclared global variables like
resultandtotal. These should be local variables (withvarin front of their first use to make them local variables).