I'm a newb, and while I can figure most things out....
Pretty much new to jQuery and while I have managed to do a lot of what I want I don't have a clue here, so I am humbly asking for help.
I have a calculation I need to make, so I searched around and found jQuery Calculation Plug-in (v0.4.07).
As a test, I included the various .js files that I need to make everything work on a small test page and have been trying to create a small table of 1 row with 4 cells across.
The cells are labeled pH, Cl, T and CT from left to right
What I need to do is have the user input the first 3 cells and after entering that 3rd number, put the result of the calculation into the 4th (CT) cell.
The Calculation is as follows:
Math.round(0.2828 * ( Math.pow(pH,2.69) ) * ( Math.pow(Cl,0.15) ) * (Math.pow(.933,(T-5))) * 1))
I have tested the calculation itself and I know it works properly, then I put in what I think is the code I need but it doesn't work. I am probably missing something extremely simple and stupid, but hey, I am a newbie :) Any help would be greatly appreciated as I just don't know what the heck I am doing here...
- $("[id^=CT]").calc(
// the equation to use for the calculation
"Math.round(0.2828 * ( Math.pow(pH,2.69) ) * ( Math.pow(Cl,0.15) ) * (Math.pow(.933,(T-5))) * 1))",
{
pH: $("input[id^=pH]"),
Cl: $("input[id^=Cl]"),
T: $("input[id^=T]")
},
function (s){
return s;
},
function ($this){
var sum = $this.sum();
$("input[id^=CT]").text(sum.toFixed(2));
}
);
</script>
</head>
<body>
<table border="0" id="calculation">
<tr>
<TD>pH: <input type="text" name="pH" id="pH" value=""></TD>
<TD>Cl: <input type="text" name="Cl" id="Cl" value=""></TD>
<TD>T: <input type="text" name="T" id="T" value=""></TD>
<TD>CT: <input type="text" name="CT" id="CT" value=""></TD>
</tr>
</table>