Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ Setting value in combobox with option groups

Posted by: JonWayn1970 Apr 6 2021, 04:36 AM

I am trying to automate a website. I need to select an item in a select element that has optgroup tags in it. Usually i would encounter select elements without optgroup and i would set the selectedItem property to a number corresponding to the value i want. In this case however, there are option groups. How is it done. Thank you

Posted by: pandy Apr 6 2021, 07:48 AM

I don't think the optgroups matter. But maybe I misunderstand.

Posted by: JonWayn1970 Apr 6 2021, 11:47 AM

QUOTE(pandy @ Apr 6 2021, 07:48 AM) *

I don't think the optgroups matter. But maybe I misunderstand.

You are right. SelectedIndex works except it pushes the index off by the optgroup positions. Thank you

Posted by: pandy Apr 6 2021, 01:08 PM

Oh, good then. smile.gif

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)