I have one input in which you can enter value, that gets checked and if it is greater than number in if statement, it gets value of percentage in second, disabled field...
Now the problem came out when I tried to check it on different numbers, with else if and else statements. I'm jQuery nooby and I don't know how this can be solved..
So far I have this situation: http://jsfiddle.net/dzorz/xFHte/
html:
<input type="text" class="entered" id="entered" name="entered">
<input type="text" class="percent" id="percent" name="percent" disabled>
script:
$(".entered").change(function(){
if(parseFloat(this.value) > 39617756.85){
$(".percent").val('1%');
}
else if(parseFloat(this.value) > 19205010.98){
$(".percent").val('2%');
}
else if(parseFloat(this.value) > 12378426.86){
$(".percent").val('3%');
}
else(parseFloat(this.value) > 1242179.25){
$(".percent").val('not qualified');
}
});
what am I doing wrong?
parseFloat()calls by addingvar val = parseFloat(this.value)at the beginning of your function and then in eachifjust testval...