• Resolved Labeeb Latheef

    (@labeebta)


    I’ve added number field to the product page. Set minimum as ‘0’ and maximum value as ’99’. If someone use up and down buttons in field, it can go below ‘0’, like -1, -2, -3… The maximum it can go is 99 as I set. But again, another problem is customer can input any number if they type directly. Higher than the maximum limit.

    Is there any workaround for this ? I would like to show error if someone enter higher than maximum value.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Contributor sarkparanjothi

    (@sarkparanjothi)

    jquery( document ).on( "keydown", "name selector", function(e){
         if( parseInt($(this).val() + e.key) > 99 ) {
             alert( "Please enter below 99." );
             e.preventDefault();
         } else if ( parseInt($(this).val() + e.key) < 1 ){
             alert( "Please enter above 0." );
             e.preventDefault();
         }
    });

    To change

    name selector

    to your input field class or name

    add this script into webpage.

Viewing 1 replies (of 1 total)
  • The topic ‘Number Field Validation’ is closed to new replies.