Aniket Aniket - 1 month ago 15x
Javascript Question

Sumo select remove all indexes and reset

I have integrated Sumoselect. select it for cascading state and city dropdown.
Initially City drop is blank. On section of States, it adds Options under City dropdown.
Question is how to remove all options of City dropdown, if someone de-selects all the selected states?
There is only provision to remove options using index. So how to remove all the options at one time?


Get all indexes in num variable.

var num = $('option').length;

for(var i=num; i>=1; i--)