BUG: The selected attribute of an option element is missing in a cloned ComboBox control (829907)
The information in this article applies to:
- Microsoft Internet Explorer (Programming) 6.0
- Microsoft Internet Explorer (Programming) 5.5
SYMPTOMSIn a ComboBox control or in a ListBox control, you may set the selected attribute of an option element that is other than the first option
element. If you use the cloneNode method in script code to clone the ComboBox control or the
ListBox control, you notice that either the selected attribute is missing or that the selected attribute is set for the first option element.WORKAROUNDTo work around this problem, store the selectedIndex property value of the option element before you clone the
ComboBox control or the ListBox control. Then, set the selectedIndex property value of the cloned control with the stored
value. For example, you may use the following code to clone the
oCombobox ComboBox control: var clonedCombobox = oCombobox.cloneNode(true);
To work around the problem, modify your code as follows:
var i = oCombobox.selectedIndex;
var clonedCombobox = oCombobox.cloneNode(true);
clonedCombobox.selectedIndex = i;
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
REFERENCESFor more information about the cloneNode method, visit the
following Microsoft Developer Network (MSDN) Web site:
| Modification Type: | Major | Last Reviewed: | 4/21/2006 |
|---|
| Keywords: | kbScript kbControl kbhtml kbbug KB829907 kbAudDeveloper |
|---|
|