I\'m trying to empty select options when:
id \"mClick\" is selected, id\'s \"sClick\", \"cClick\" and \"srClick\" will be emptied.
id \"sClick\" is selected,
The easiest way to clear the options in the way you're describing is by using options.length = 1. Also, you can leverage the fact that each drop down clears the ones that logically follow it, so that you only need to declare a single change handler.
$('#lForm select').on('change', function() {
if (this.selectedIndex > 0) {
var $others = $(this).closest('table').find('select'),
current = $others.index(this); // find current
while (++current < $others.length) {
// for each following drop down
$others.get(current).options.length = 1;
}
}
});
Demo
I'm not sure how you're going to repopulate the drop downs though :)