Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery change input value if greater than

jQuery("input[type='text'][name='quantity']").change(function() {
    if (parseInt($(this).val(),10) > 40) {
        alert("To order quantity greater than 40 please use the contact form.");
        this.value == '';
        /* or with jQuery: $(this).val(''); */
        $(this).focus();
        return false;
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #change #input #greater
ADD COMMENT
Topic
Name
2+4 =