Adding 2 Multiselect Checkboxes
I'm using 2 jQuery UI widgets that adds the selections and only allows the user to select 5 total checkboxes between both dropdown widgets. I'm able to prevent the user from checki
Solution 1:
Your code almost works properly, but in your click
function, this
was returning the entire select list, so !this.checked
would always be true because it was undefined.
If you use the ui
variable, which is the option that was clicked, it will give you the proper result.
click: function (event, ui) {
if (ui.checked && $(".multiselect").children(":checked").length >= 5) {
returnfalse;
}
},
Here is an example of it working in jsfiddle: http://jsfiddle.net/3u7Xj/3/
Post a Comment for "Adding 2 Multiselect Checkboxes"