...
So the first thing we will do is add jQuery to our screen branding. This code is pretty generic and should work in versions of jQuery from 1.4.X up to the latest.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |
Now we need to attach a key press handler to the coupon code entry field and then give it logic to click the apply coupon submit button.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<script type="text/javascript"> jQuery(document).ready(function() { jQuery('input[name="couponCode"]').keypress(function (e) { var code = e.keyCode || e.which; if (code === 13) { e.preventDefault(); jQuery("#APPLY_COUPON").click(); } }); }); </script> |
...