we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "jquery change input value if greater than"
Emilia
17 Nov 2017
1jQuery("input[type='text'][name='quantity']").change(function() {
2    if (parseInt($(this).val(),10) > 40) {
3        alert("To order quantity greater than 40 please use the contact form.");
4        this.value == '';
5        /* or with jQuery: $(this).val(''); */
6        $(this).focus();
7        return false;
8    }
9});