Here's my set up. On the page there's a dropdown box. When the value of this dropdown is changed, I build out the HTML for any number of multiselect boxes (based on the value chosen in the dropdown) via an AJAX call (I build out the HTML along with bind events on these multiselects) via a .load( ) call). In my callback, I trigger this event which applies the multiselect to these dynamically-generated multiselect boxes. The problem is that the multiselect doesn't get applied consistently. Sometimes it works perfectly, other times I get the following error message:
$('#denials').multiselect( ) is not a function
At first I thought maybe the DOM wasn't being loaded, or maybe the HTML wasn't being loaded, but then I threw in a setTimeout( ) where I trigger the event as the callback. I still get this error sometimes (it's about a 50/50 shot whether it works correctly) even though I can see that the multiselects have fully loaded.
Is there any issue with applying this widget to multiple dynamically-generated multiselect boxes on the same page? Is there something else I'm missing?