[whatwg] Re: several messages

voracity subs at voracity.org
Thu Jul 1 06:02:43 PDT 2004


Oh, I also have a request for the DOM with respect to autocomplete fields:

(the following is mostly copy/paste from my past posts)

I'd like the currently selected option to be exposed. Thus if a person has 
chosen (or typed) 'Choice 2', you could use 'combo1.selectedOption' to get the 
chosen element (i.e. <option value="Choice 2"/>). If the user has typed 
something new (or hasn't type anything at all), then 'combo1.selectedOption' 
would be null.

This is a) So I can determine in a script whether something new (not on the 
list) was entered and b) so I can add my own attributes to each <option> that I 
can then use to do other things with.

I can do that without .selectedOption, but it would be more painful (and 
probably slow for big lists). And, ultimately, it would always be a hack that 
implements something exactly like .selectedOption.

Now, if datalists have similar properties to select's in the DOM (i.e. a 
.selectedIndex property, a .options array, etc.) then that would probably be 
good enough.



More information about the whatwg mailing list