I'm having a period mental melt down here. For 2 days, I've been looking at numbers and trying to get this damn calculation to work, but now i can't get the result method to work.
I'm having 1 textboxs, 2 checkboxs, 1 dropdown and a h1 where the result will be shown.
What i need help with is the calculation and the showing of the result. Heres the JQuery code I'm having.
var iAlt = 0;
// DROPDOWN
var halloAbo = "";
$('#hallo-abo').change(function (){
halloAbo = $('#hallo-abo').val();
//$('#sk').text(halloAbo);
});
// TEXTBOX
var maxregning = 0;
$('#maxRegning').focusout(function(){
maxregning = 0;
maxregning = $('#maxRegning').val();
$('#sk').text(maxregning);
});
// SELECT 1
var pakkerTotal = 0;
$('#pakker :checkbox').click(function() {
pakkerTotal = 0;
$('#pakker :checkbox:checked').each(function(idx, elm) {
pakkerTotal += parseInt(elm.value, 10);
});
//visResultat();
});
// SELECT 2
var betalTotal = 0;
$('#betal :checkbox').click(function() {
betalTotal = 0;
$('#betal :checkbox:checked').each(function(idx, elm) {
betalTotal += parseInt(elm.value, 10);
});
//visResultat();
});
// NEED HELP HERE
var buffer1 = 0;
var buffer2 = 0;
function visResultat(){
iAlt = eval(maxregning -= pakkerTotal -= betalTotal);
$('#sk').text(iAlt)
}
//$('#sk').text(iAlt);
Heres some of the HTML
// DROPDOWN
<select id="hallo-abo" style="float:left;">
<option value="">Vælg dit abo</option>
<option value="49">test 1</option>
<option value="99">test 2</option>
ect
</select>
// TEXTBOX
<input type="textbox" id="maxRegning" value="" />
// CHECKBOX 1
<div id="pakker">
<input type="checkbox" value="39" />test 1<br/>
<input type="checkbox" value="79" />test 2<br/>
</div>
//CHECKBOX 2
<div id="betal">
<input type="checkbox" value="6,5" />test 1<br/>
<input type="checkbox" value="36" />test 2
</div>
// RESULT
<h1 id="sk">0</h1>
Hope some one can help me here