tags:

views:

33

answers:

2
select.onchange = function() {
   this.value; 

}

It's easy to retrieve the value but now I need the text of the selected element. How to do it?

+2  A: 

(Sorry... put .value before my edit instead of .text by accident 8-)...)

this.options[this.selectedIndex].text
Matt
A: 
//assuming "this" is the select element
if (this.selectedIndex >= 0) {
  this.options[this.selectedIndex].text = "some text";
}
Graza