Checkbox limit
-
Hi,
I have a form created with Elementor and I need to create a function so that in the form’s checkbox, only 3 options can be selected. I have created a code and tried to add it to function.php but it shows a syntax error.
The code is the following:
jQuery(document).ready(function() {
var checks = jQuery(“.elementor-form input[type=checkbox]”);
var max = 3;
for (var i = 0; i < checks.length; i++) checks[i].onclick = selectiveCheck; function selectiveCheck (event) { var checkedChecks = jQuery(“.elementor-form input:checked”); if (checkedChecks.length >= max + 1)
return false;
}
});Can someone tell me why these lines of code in the theme’s function.php give me an error? And if there is any different function I can try. I would appreciate an answer from someone.
Thanks,
Laura.
- The topic ‘Checkbox limit’ is closed to new replies.