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


Groups > comp.lang.javascript > #20347

Where have the select options gone?

Newsgroups comp.lang.javascript
Date 2013-06-19 08:09 -0700
Message-ID <fdce89f6-708b-42b3-bade-ddab5db088dd@googlegroups.com> (permalink)
Subject Where have the select options gone?
From justaguy <lichunshen84@gmail.com>

Show all headers | View raw


Hi,

I'm puzzled by the following or more likely I don't know better.

I have this form with a select element and then I want to see what is selected on the same page, code is like this:

<select id="me">
 <option>apple
 <option>orange
  ...
</select>

<span id="findme"></span>

js after user has selected the above:

if (document.getElementById('me')) {
 var ee = document.getElementById('me');
 var eev = ee.options[ee.selectedIndex].value;	
 document.getElementById('findme').innerHTML = eev;
 }
else {alert('WHY me field NOT FOUND');}

I expect to see the span id to display the value of the selected option
but I get the alert instead, what's wrong?

Thanks.

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


Thread

Where have the select options gone? justaguy <lichunshen84@gmail.com> - 2013-06-19 08:09 -0700
  Re: Where have the select options gone? Luuk <luuk@invalid.lan> - 2013-06-19 19:10 +0200
    Re: Where have the select options gone? justaguy <lichunshen84@gmail.com> - 2013-06-19 11:16 -0700
  Re: Where have the select options gone? Danny <dann90038@gmail.com> - 2013-06-19 10:55 -0700

csiph-web