JQuery UI MultiSelect Widget selection saved in IE but not Chrome

I am using jQuery MultiSelect Widget . When using IE, if I select 3 options from the main drop-down list, go to another page and then click the back button, the values ​​are saved in the drop-down list. If I refresh the page, the values ​​are still saved. Strength renewal cleans up values.

In Chrome, if I do the same, the values ​​are not saved.

With my website (which, unfortunately, is not yet accessible via the Internet), in IE8 the checked state of the flags seems to be saved visually, but the state of the flag is not checked.

I tried calling the uncheckAll method and the checkboxes are still checked. I put a warning in my code to display the number of selected options, and the value is zero, even if the checkboxes are selected.

How is the state of the multi-select list maintained by IE and can it be prevented?

+4
source share
2 answers

Calling the unchekAll () method for a multi-second plugin seems to be the easiest way. Since I do not see your code, perhaps you are not calling it in the correct way:

$("select").multiselect("uncheckAll"); 

But now, where to call this method?

For cross-browser consistency, I think the right way is to use the onbeforeunload handler, which runs in all browsers, as I know. Thus, this fragment should work in all cases:

 window.onbeforeunload = function(){$("select").multiselect("uncheckAll")}; 

Let me know if this fixes your problem?

0
source

Try unlinking before binding the widget. It is good practice to untie the event attachments before installation in order to avoid such problems as described above.

Try

 $("select").unbind(); 

And then attach the multi-selection. jquery-unbind () off () all equally uses the one that matches your jquery version. I think you will have the same problem in the mosaic.

0
source

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


All Articles