Reputation: 11
Below is my code which I am using.. Here I am getting values from form elements. Please guide me through it.. It is not giving proper result.
var outoff11 = document.getElementById('out_off11').value;
var acc11 = document.getElementById('acc11').value;
var temp = acc11 <= outoff11;
if(temp){
alert("True");
alert(outoff+acc);
}
else{
alert("False");
alert(outoff+acc);
}
Thanks in advance..
Upvotes: 0
Views: 94
Reputation: 2753
Change
var temp = acc11 <= outoff11;
to
var temp = parseInt(acc11,10) <= parseInt(outoff11,10);
Upvotes: 1
Reputation: 3643
How about:
var outoff11 = parseInt(document.getElementById('out_off11').value, 10);
var acc11 = parseInt(document.getElementById('acc11').value, 10);
Upvotes: 1