Want to use JavaScript to remove all elements of a select object? Don't do this:
for (i=0; i < form.yourSelector.length; i++) {
form.yourSelector.remove(i);
}
...and don't do this either:
l = form.yourSelector.length;
for (i=0; i < l; i++) {
form.yourSelector.remove(i);
}
Instead, do this:
l = form.yourSelector.length;
for (i=0; i < l; i++) {
form.yourSelector.remove(form.yourSelector.length - 1);
}
13 hours ago