Skip to content

Instantly share code, notes, and snippets.

@wpmonks
Created December 31, 2019 04:28
Show Gist options
  • Save wpmonks/d26d1436f2cd3490cd0b6077f0279e30 to your computer and use it in GitHub Desktop.
Save wpmonks/d26d1436f2cd3490cd0b6077f0279e30 to your computer and use it in GitHub Desktop.
Set Limit for Number's field in WPForms with Minimum and Maximum values
/**
* Set minimum and maximum range for number field
* Apply the class "bfwpf-number-range-limit" to the field to enable.
*
* https://wpmonks.com/blog/how-to-min-max-range-for-number-fields-in-wpforms/
*/
function bfwpf_number_field_range_limit() {
?>
<script type="text/javascript">
jQuery( function($) {
$('.bfwpf-number-range-limit input').attr( {'min':12, 'max':13} );
});
</script>
<?php
}
add_action( 'wpforms_wp_footer_end', 'bfwpf_number_field_range_limit', 30 );
@cubatrytest
Copy link

Thank you for this, how do I this for another form with different set of min/max quantity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment