Busted Mug

A blog that documents solutions to the most frustrating problems that occur during development in technologies such as Java, XML, AJAX, SQL, CSS and others that make me want to throw my coffee mug against the cube wall.

Thursday, November 30, 2006

Select Boxes - clear all options - except the last one

Update:I was a blithering idiot when I posted this. Read this post. If you're messing with dynamic select boxes here's a good reference. I ran into a problem. Apparently you can't remove the last option (makes sense - how can you have no options?). To make the select appear blank you end up doing something like this:
if (this.selectedDates.length == 0) document.getElementById(this.listName).options[0] = new Option("","");
It just inserts a blank option.

1 Comments:

At 3:34 AM, Blogger tachjava said...

Hi,

Useful information. Very well explained. Thanks for sharing.

Cheers,
http://www.flowerbrackets.com/java-if-else/

 

Post a Comment

<< Home