W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2004

[whatwg] Re: several messages

From: voracity <subs@voracity.org>
Date: Thu, 01 Jul 2004 23:02:43 +1000
Message-ID: <40E40B73.4010602@voracity.org>
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.
Received on Thursday, 1 July 2004 06:02:43 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:35 UTC