Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Multiselect widget clear all check boxes

Hopefully a quick one...

I need to fire the uncheckAll event in the click event of a separate button on my page, I have tried the following:

$('.masterProviderOrgsListBox').multiselect().uncheckAll();

but this isnt a recognised method. I basically want to fire the same method that is fired when you click the "Uncheck All" box in the header.

I was previously doing this:

$('.masterProviderOrgsListBox option:selected').removeAttr("selected");

but this removes the selections on the actual multiselect rather than the jQuery UI widget.

Couldnt find anything in the documentation, any ideas?

like image 927
Declan McNulty Avatar asked May 17 '12 09:05

Declan McNulty


2 Answers

Methods

After an instance has been initialized, interact with it by calling any of these methods:

// example: $("#multiselect").multiselect("method_name");

...which can be found in the widgets documentation under Methods

$("#multiselect").multiselect("uncheckAll");
like image 155
billyonecan Avatar answered Sep 27 '22 22:09

billyonecan


1) first, you need to set default value of the control.

jQuery('#multiselect').val("");

2) Then, execute below code to reset the control.

jQuery('#multiselect').multiselect("refresh");

like image 38
daudichya Avatar answered Sep 27 '22 21:09

daudichya