The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Setting value in combobox with option groups
JonWayn1970
post Apr 6 2021, 04:36 AM
Post #1





Group: Members
Posts: 2
Joined: 6-April 21
Member No.: 27,882



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 6 2021, 07:48 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



I don't think the optgroups matter. But maybe I misunderstand.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
JonWayn1970
post Apr 6 2021, 11:47 AM
Post #3





Group: Members
Posts: 2
Joined: 6-April 21
Member No.: 27,882



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 6 2021, 01:08 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Oh, good then. smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 02:00 AM