Input text - detecting ODD number

Hi people,

I’ve got a few input text fields and a submit button on an order form I’ve designed. Trouble is you can only order in multiples of 2. Naturally I have a warning stating that orders must be multiples of that number but there is always room for idiocy!

Lets say my order input text box is called “order” and the button used to proceed to payment is called “submit”. How do I detect an ODD number entry and have it run an mc called “warning”?

Does that make sense to anyone because I’m confusing even myself - which admittedly isn’t hard for me today.

Thanks.


var numOfItems = Number(this.order.text);
if(numOfItems%2 !=0){
 bringWarning();
}


SHO

note that Number() will convert the number based on an octal radius if it’s preceded by a 0, i.e. 013 as opposed to just 13. To prevent that, you can use parseInt()