Javascript – Limit Checkboxes

[themify_is_logged_in]

[js]<script type="text/javascript">
$(‚.wpuf_kategorie_367‘).on(‚change‘, function() {
if($(‚.wpuf_kategorie_367:checked‘).length > 5) {
this.checked = false;
}
});
</script>[/js]

or

[js]</pre>
<script type="text/javascript">
jQuery(document).ready(function( $ ){
$(".wpuf_kategorie_59").change(function() {
var count = $(".wpuf_kategorie_59:checked").length; //get count of checked checkboxes

if (count > 6) {
alert("You can select only 6 Categories..!");
$(this).prop(‚checked‘, false); // turn this one off
}
});
});
</script>
<pre>
[/js]

[/themify_is_logged_in]