I would like the script to multiply values from input boxes by the values of hidden inputs, and print the result upon clicking the button.
Script pretty much does it but only for 1 input.
Any easy way to do it?
Much appreciated.
Fiddle: http://jsfiddle.net/eN7S6/3/
<table>
<tr>
<td>
<input name="inputone" id="inputone" class="calc" value="1"><span id="Total"></span>
</td>
</tr>
<tr>
<td>
<input name="inputone" id="inputone" class="calc" value="1"><span id="Total"></span>
</td>
</tr>
</table>
<input name="inputtwo" id="inputtwo" class="calc" value="2" type="hidden" readonly>
<input name="inputtwo" id="inputtwo" class="calc" value="3" type="hidden" readonly>
<input type="button" id="update" value="Calculate" />
And jQuery
$(document).ready(function() {
$('#update').click(function() {
var inputone = $('#inputone').val();
var inputtwo = $('#inputtwo').val();
var totalTotal = ((inputone * 1) * (inputtwo * 1));
$('#Total').text(totalTotal);
});
});