Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Since when is 2 greater 15(simple if statement going awry)

This is a snippet of a larger website I working on. All I am trying to do is some input validation. If the number they insert in a text box is greater then the max value(which is a attribute of the input box) display a tipsy error and grey out button etc. Well i can not figure out what is happening here.

>if(value>max)

>value:1 max:15 = No error
>
>value:2 max:15 = Error

>..... =Error
>
>value:10 max 15 = No error

So i took my code out of the website and put it in jsfiddle http://jsfiddle.net/V9xfj/

and it does it in there as well. Type in a 2 and you will get an error.

What am i doing wrong

like image 883
GerritVK Avatar asked Jan 29 '26 07:01

GerritVK


1 Answers

2 is greater than 15 if they're strings or any other alpha sort

like image 198
Thomas Avatar answered Jan 30 '26 21:01

Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!