I use chosen plugin frequently, of course I run into this issue more than once.
normally use .trigger("chosen:updated")
can solve it. But just one minute ago, this method doesn’t work any more, I feel so confused, cause I use a same function in 2 js file, let’s say the a.js
and b.js
, it works in a.js
, but not work in b.js
. I can’t figure out why… I almost lose my mind!!!
So, I check the api again.I found the .chosen("destroy")
, inspired me!
And I think it’s the Ultimate Solution: destroy it and rebuild it.
$('.chosen').chosen("destroy").chosen();
Am I too loud? :p