I try to get this code to work with the 3 input fields, but it works only with the first :
<form>
<p><input id="qty" type="text" maxlength="1" /></p>
<p><input id="qty" name="text" type="text" /></p>
<p><input id="qty" name="text2" type="text" /></p>
</form>
<script type="text/javascript">
$("#qty").change(function(e) {
if(this.value != '3' && this.value != '6' && this.value != '9') {
this.value = 0;
alert('You can buy only 3, 6, or 9 pieces fromn this product');
} });
</script>
What can be my error ?