According to this JS code, I can limit the number of checked boxes in a Checkbox field.
<script type="text/javascript">
jQuery(document).ready(function($){
var limit = 3;// Change 3 to your limit
$('input[name="item_meta[364][]"]').change(function(){
var checkbox_num = $("input[name='item_meta[364][]']:checked").length;
if ( checkbox_num > limit ) {
this.checked = false;
}
});
});
</script>
And it works well, even there is a built-in mode to accomplish this.
But it does not work however in the checkboxes mode of a Dynamic field. I tried even changing "input" by "select", but it keeps failing. Unfortunately, checkboxes mode of Dyn fields has not a Limit selection option.
What's the secret here? Not referencing it correctly?
(EDIT: I tried to change this question to Code Help editing it but I couldn't.)
Please login or Register to submit your answer