I have an input which will have a certain number in it. If they put an incorrect interval number in the input and click the submit button I want it to alert instead of proceeding.
Best shown in Example:
Say one enters 7, 8, 9, 10 or 11. I would want an alert("Please enter intervals of 6") show up and the addtocart input not fired. The input value on each page is dynamic, and could be 1, 6, 12, etc..
<input value="6" type="text" onkeydown="javascript:QtyEnabledAddToCart();" >
<input class="vCSS_input_addtocart" type="image" src="btn_addtocart.gif" name="btnaddtocart" onclick="return addToCart(this.form, this);">
Perhaps I have to use a change() function?
Use Modulus function like:
Operators/Modulus.htm”>http://www.java2s.com/Tutorial/JavaScript/0040_Operators/Modulus.htm
Working example:
http://jsfiddle.net/Y3SEJ/2/