Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40482

Re: Get droplist index value by name?

Newsgroups comp.lang.javascript
Date 2021-10-14 23:47 -0700
References <d531c3e4-99ec-4c71-a5d8-ce0a28ade350n@googlegroups.com>
Message-ID <d33cbe66-e870-45a0-aef2-7f17210312ffn@googlegroups.com> (permalink)
Subject Re: Get droplist index value by name?
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


fredag 15 oktober 2021 kl. 08:41:19 UTC+2 skrev Jonas Thörnvall:
> I have a dropdown "select option list" holding midi portIDs. 
> So reading the dropdown i know the name of available midiports. 
> 
> I can visualy inspect to know the index of the ID i want. 
> 
> But how can i use the ID to retrieve the index? 
> ctrlportindex=parent.document.getElementById("parent.out_portsel").value // "FW1884 Control" 
> 
> It is the the index of the Id of element out_portsel i am looking for? 
> 
> Maybe i am doing it backward but i use the index to select output port. 
> In this case i know the "id" i want, but want is its index in the dropdownlist?
I could probably loop through the id's equal to "x" and read out the index by loop counter.
But it seem a "A BIT IDIOTIC" if there already is a function for retrieving it.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Get droplist index value by name? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-14 23:41 -0700
  Re: Get droplist index value by name? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-14 23:47 -0700
    Re: Get droplist index value by name? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-14 23:49 -0700
      Re: Get droplist index value by name? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-15 00:18 -0700

csiph-web