Created
December 31, 2019 04:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this, how do I this for another form with different set of min/max quantity.