Closed reniraj closed 11 years ago
What you should do on success is not re-applyign chosen on $("#lhs-flr-region")
(which will do nothing as it is already applied) but trigger the chosen:updated
event to make Chosen update itelf. See the documentation
Replace
$("#lhs-flr-region").data("placeholder","Select").chosen();
with:
$("#lhs-flr-region").data("placeholder","Select").trigger('chosen:updated');
But next time, ask such questions on StackOverflow as stated in the contributing guide.
if the next answer dont work you can try to replace : $("#lhs-flr-region").data("placeholder","Select").trigger('chosen:updated'); by $("#lhs-flr-region").data("placeholder","Select").trigger('liszt:updated');
@fallphenix you should rather upgrade from 0.9.x to the uptodate version instead of switching back to the old event name
@stof right, i worked with Version 0.9.8 in my old apps. I just look for the way that i done. the last version is v1.1.0 https://github.com/harvesthq/chosen. thanks for advices. @Gitthub is the best
I have two dropdown fields. First one contains country and second one contains regions inside the country. So what i am trying to do is when selecting countries, i need to load respective regions in the second field via ajax using jquery and PHP.
It worked for me for the first time. Next time i change the country, it does not load regions in the second field. How do i add the second trigger result to my select field, removing the old values. I am using custom select field - chosen.js
All the Select box are run in chosen style on page load. Select box 1 - Country (Initiale load) Select box 2 - Region Select box 3 - City (Feature use)