I’d like to remove all items from a dropdown menu and replace the old list with a new one in the same dropdown.
I’ve tried $w(“#dropdown2”).options = [];
Thanks!
I’d like to remove all items from a dropdown menu and replace the old list with a new one in the same dropdown.
I’ve tried $w(“#dropdown2”).options = [];
Thanks!
Hi Brian,
Is your dropdown connected to a dataset? If it is, you cannot change it by using code.
You must disconnect it and set its options on page load (onReady function) instead.
Then you will be able to empty it by calling $w(" #dropdown2 ").options = ;
Thanks a lot Ido,
It wasn’t connected to a dataset.
I moved $w(" #dropdown2 ").options = ; to page load as you kindly suggested and also added it just before the code that re-populates the dropdown items just to make sure.
All working now!