I'm attempting to check the values entered by a user into an input text field. Once they enter the value and click submit, if the value they enter matches a value in an array, I'm attempting to produce one result, if not in the array, another result.
Basically have a simple form like so:
<form id="checkinput" action="#">
<input type="text" value="" id="couponcode" name="coupon code name"/>
<input type="button" id="submit" value="Submit"/>
</form>
When click "#submit", if value in the "#couponcode" input field equals the value in an array, add a class of "success" to a div with an id of "success_show" otherwise a simple alert like "your coupon code is wrong" would be displayed.
I'll have a hidden div and upon success, add a class of "success" to the div.
The array will change periodically and will have different quantities at different times. Something simple like so:
var arr = [ "CA238", "Pete", 8, "John" ];