see it in action here: http://jsbin.com/relamiqeru/1/
I am trying to make it so that if a user enters "idh4" into the coupon code field, my "booyah" div gets filled with that html provided.
The issue I feel, is that the javascript is only executed when the page is loaded, so even if idh4 is entered into the field, its not checking it anymore. Perhaps an if statement is not the right thing to use in this case?
At request, here is the jsbin code:
<div id="booyah"></div>
<form action="" method="POST">
Coupon Code?<input id="couponcode" type="text" name="coupon code" value="idh4"><br>
<input type="submit">
</form>
$("#couponcode").change(function(){
if ($("#couponcode").val() === 'idh4') {
console.log('it got called');
$( "#booyah" ).html("<p>That code gets you free snappie stickers!</p>");
}
});