I received an answer on github wich answer perfectly my question:
jQuery chosen, second trigger doen't work
-
29-09-2022 - |
Question
I have a chosen combobox (with multiples values).
I have 2 buttons: first has this function in order to add a value in the combobox
$('select option[value="13"]').attr('selected', 'selected')
$('select').trigger('chosen:updated');
Second button has this function in order to remove this value:
$('select option[value="13"]').removeAttr('selected')
$('select').trigger('chosen:updated');
- I call my page: everything is fine
- Click on first button: ok, the value is added
- Click second button: ok, the value is removed
- Click another time on first button: problem, the value is not added
You can see an example here: http://jsfiddle.net/pingoooo/7NWEd/1/
Can you tell me why the second time I click on the first button, the function doesn't work.
I use chosen version 1.0
Thanks
EDIT: seems that works on chrome but why not IE and FF
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow