JQuery UI Multiselect widget clear all checkboxes

Hope fast ...

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

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

but this is not a recognized method. Basically, I want to run the same method that starts when you click "Cancel All" in the header.

I previously did this:

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

but this eliminates the choice in a real multi selector, not in jQuery widgets.

Could not find anything in the documentation, any ideas?

+6
source share
3 answers

Methods

After the 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 in the Methods section

 $("#multiselect").multiselect("uncheckAll"); 
+11
source

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

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

2) Then execute the control reset code below.

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

+1
source
 $("#multiselectoption:selected").removeAttr("selected"); $("#multiselect").multiselect('refresh'); 

The update should be called after resetting the drop-down list.

0
source

Source: https://habr.com/ru/post/915975/


All Articles