jQuery calculation plugin: show total in form field rather than text
- by Katherine
I'm embarrassed by the 'basicness' of this question, but after wasted hours, here goes.
In an effort to do something with the jQuery Calculation plugin, I am playing with the basic example of the order form on the plugin site. I want to have the grand total as a form field,rather than text, so I can use the value.
The function that calculates and shows the grand total is:
function ($this){
// sum the total of the $("[id^=total_item]") selector
var sum = $this.sum();
$("#grandTotal").text(
// round the results to 2 digits
sum.toFixed(2)
);
}
the total updates on keyup in:
<span id="grandTotal"></span>
But this does not work with:
<input type="text" id="grandTotal" value=""/>
Can anyone point me to what I need to add/change to make that work? To call my javascript basic would be a compliment, so please talk to me like I know nothing!