help adding 3 text box values and show in a 4th
Good Afternoon every one
I'm very new to jquery and javascript I have 3 text boxes that I need to add up there values and display the result in a 4th textbox I have a functiion that I got from a friend but it's not calculating the 2nd textbox value which is populated form a total of a table column
I've tried every thing and cannot get this to work here is the code
- <script type="text/javascript">
$(function () {
var textBox1 = $('input:text[id$=tij]').keyup(foo);
var textBox2 = $('input:text[id$=ptotal]').keyup(foo);
var textBox3 = $('input:text[id$=labor]').keyup(foo); //this amount comes from a tabal column total
function foo() {
var value1 = textBox1.val();
var value2 = textBox2.val();
var value3 = textBox3.val();
var sum = add(value1, value2, value3);
$('input:text[id$=jbtotal]').val("$" +sum+".00"); }
function add() {
var sum = 0;
for (var i = 0,
j = arguments.length; i < j; i++) {
if (IsNumeric(arguments[i])) {
sum += parseFloat(arguments[i]); }
} return sum; }
function IsNumeric(input) {
return (input - 0) == input && input && input.length > 0; } });
</script>