I have two select dropdowns, When i change first select, onchange function will execute but options not updated in chosen 2nd dropdown. But options populated in orginal select.
Onchange function generate dynamic options for second select, when i inspect element original select updated, chosen results area not updated.
I follow below code.
<select id="account" onchange="changePackage()">
<select id="package">
javascript
$(select).chosen();
$("#account"). on('change',function(){
$("#package").trigger('chosen:updated');
If I understand your question correctly, this should help you. You just need to add the callback function which will be executed after the select is updated:
function changePackage(){
changePackageChosen(function(success) {
if(success) {
$("#package").trigger('chosen:updated');
}
});
}
function changePackageChosen(callback){
/* binding options*/
callback(true);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.