The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Limit the number of checkboxes that can be selected
I have a checkbox with 8 options but I need to restrict the number that can be selected to 4.
Any ideas as to how I do this please?
Many thanks
Barbara
September 27, 2017 at 4:15 am
You will have to use javascript. I used the codes below in a previous site.
// Change 2 to your limit
// Chagne 927 to the ID of the checkbox
jQuery(document).ready(function($) {
var limit = 2;
$('input[name="item_meta[927][]"]'fills).change(function() { var checkbox_num =
$("input[name='item_meta[927][]']:checked").length; if ( checkbox_num > limit ) { this.checked = false; } }); });
September 29, 2017 at 8:18 am
Thank you for trying to help Albert. Where would I paste the code? I've tried lots of places but cannot get it to work.
Discussion closed.