Rams
Rams

Reputation: 41

Clearing semantic ui multiselect dropdown when values are selected dynamically?

I am trying to load multiselect dropdown value based on click button action dynamically. When one click is performed value is selected and appended in the dropdown. But when I clicked next time, the dynamic values are appended to the previous value. So I decided to clear multiselect dropdown on each click.

But when values are selected dynamically, To clear dropdown

$('.ui.fluid.dropdown').dropdown('restore defaults');

$('.ui.fluid.dropdown').dropdown('clear');

Both also not working. Because of dynamic appending of data.

So my question is how to clear semantic mutiselect dropdown dynamically.

Upvotes: 0

Views: 2679

Answers (1)

Rams
Rams

Reputation: 41

I tried to use the following code to clear the dropdown and it works fine.

var class_name = $('.ui.fluid.dropdown');

$(class_name).dropdown('clear');
$(class_name).dropdown('destroy');
$(class_name).dropdown('restore defaults');

Upvotes: 1

Related Questions