I need a little help adjusting this code, any advice is appreciated:
The desired result is to have two values returned instead of just one, so for example:
Input Value = " " (Text box )
this.value = 226 - this.value * .5; ( value #1 Text Box2)
this.value = 226 - this.value * .9; ( value #2 Text Box3)
HTML
<form id='myform'>
<input value=" "/><br>
<a href="#" class='THR'>click to calculate THR</a><br><br>
</form>
CODE
$('a.THR').click(function() {
$('#myform :text').each(function() {
this.value = 226 - this.value * .5;
});
});
Ok, I’m not really sure what you want to accomplish but if you just want to make two calculations and display the results you can do this:
HTML:
JS:
Since you have only one input field there’s no reason to use an each loop, just give it an id and refer to it directly. The containers for the results can be anything you want as long as you can refer to them with jQuery (ids are a good choice).