gfranko / jquery.selectBoxIt.js

A jQuery Select Box Plugin for Mobile, Tablet, and Desktop
http://www.selectboxit.com
MIT License
852 stars 301 forks source link

Selectboxit bug or other kind of issue but it doesnt populate dynamicaly changed select box #352

Open thecore77 opened 8 years ago

thecore77 commented 8 years ago

Hello Gfranko, I am using your code - Thanks, nice work! I am experience this kind of issue: I have 2 select dropdowns. The fist one is country select, the second is city select. When I change the country select I am sending ajax call to php file which returns options with cities for city select dropdown menu. I am populating city select dropdown this way: $("select#city").selectBoxIt({ populate: oO, native: true,aggressiveChange: true }); where oO is array with and so on The code populates the new city select but if I have selected a specific city from a country and than I change the country with another the city dropdown holds as selected option the city from previous country and the rest of the cities are for the new country. I inspected the element ul id="citySelectBoxItOptions" and noticed that it keeps information about all cities from previous country and did not created a new ul id="citySelectBoxItOptions" element with the new country's cities

How do I fix this? Why it doesnt recreate the new elements with selectBoxIt function? Do I have to destroy first the old element ul id="citySelectBoxItOptions" ? Thank you for any help and advises !

I am attaching 2 screenshots showing the bug or the issue? screen1 screen2

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.