Empty the select element does not work ? #34
You probably need to rebuild the dropdown |
I'm having the same issue, can't seem to solve it, I'm trying to empty/remove the options of the dropdown without luck, also using brute way dropdown.html(""); won't work. It happens only when I use this dropdown plugin :( If I use normal bootstrap select class, the empty() method does work. I'm trying to achieve this by emptying a dropdown options from the "change" method of another dropdown.
my code:
my select element:
the script
The result is that the items are populated over and over again (listed cities are mixed with the previous selected state/region). Any help is appreciated. I'm using Laravel 5.1 and Blade. |
Ok, we found the problem and my work partner made it to solve it! the issue is caused by the readonly input text inside the div class "dropdownjs" for that dropdown, whenever we do the usual dropdown.empty(), it clears all options from the select element BUT the LI items inside the UL tag are still present. So since we are populating dynamicly the dropdown anytime the user changes the country or state, my partner did this:
|
To remove all options from select, this however does not work ?