Aniket Aniket - 1 year ago 397
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?

Answer Source

Get all indexes in num variable.

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

for(var i=num; i>=1; i--)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download