select.onchange = function() {
this.value;
}
It's easy to retrieve the value b开发者_高级运维ut now I need the text of the selected element. How to do it?
(Sorry... put .value before my edit instead of .text by accident 8-)...)
this.options[this.selectedIndex].text
//assuming "this" is the select element
if (this.selectedIndex >= 0) {
this.options[this.selectedIndex].text = "some text";
}
精彩评论