0

In Javascript, I was supposed to retrieve a select box' value by something like this:

var e = document.getElementById("elementId");
var value = e.options[e.selectedIndex].value;

However, it seems that under some circumstances, the simple approach also works:

 var value = document.getElementById("elementId").value;

(Look: http://jsfiddle.net/uswnk9ng/)

Unfortunately, in my program this approach does not work always.

What does this working-or-not-working rely on?

Lokomotywa
  • 2,624
  • 8
  • 44
  • 73

0 Answers0