What I want it once I get going through my form, ansering all my question and hit calculate, I want to be able to see the results as $1234 instead of just 1234. Is there a way to do that.
Also I might want to show it like this Your total cost is: $1234(based on submitted data) then a button like ADD to profile. Please help! Thank you in advance!
Script:
<script>function calculate() {
var total = (parseInt($('#studenttut option:selected').val()) + parseInt($('#campusrb>option:selected').val())) * parseInt($('#yearsatten>option:selected').val());
$("#total").text(total);
}
</script>
HTML:
<form>
<div id="1">
<table width="100%">
<tr>
<td>Are you an In-State-Student?</td>
<td align="right">
<select id="studenttut">
<option value="<?php echo $NIST; ?>">Yes $<?php echo $IST; ?></option>
<option value="<?php echo $NOST; ?>">No $<?php echo $OST; ?></option>
</select>
</td>
</tr>
</table>
</div>
<div id="2">
<table width="100%">
<tr>
<td>Are you staying on campus?</td>
<td align="right">
<select id="campusrb">
<option value="<?php echo $NBS; ?>">Yes $<?php echo $BS; ?</option>
<option value="1">No $0</option>
</select>
</td>
</tr>
</table>
</div>
<div id="3">
<table width="100%">
<tr>
<td>How many years are you planning to attend?</td>
<td align="right">
<select id="yearsatten">
<option value="1">1</option>
<option value="2">2</option>
<option value="2">3</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
</td>
</tr>
</table>
</div>
<div id="4">
<div id="total"><input type="button" onClick="calculate()" value="calculate"/></div>
</form>
</div>