开发者

Read value of select box

开发者 https://www.devze.com 2023-02-01 20:54 出处:网络
could somebody please tell me how to achieve the following: I have a SELECT with different OPTIONs. When I click on one of these opt开发者_如何学JAVAions I want the value to be shown in a DIV. I trie

could somebody please tell me how to achieve the following:

I have a SELECT with different OPTIONs. When I click on one of these opt开发者_如何学JAVAions I want the value to be shown in a DIV. I tried it with this.value but for some reason I am still doing something wrong. Can somebody please help?

Thanks


var select = document.getElementById("mySelectId");
select.options[select.selectedIndex].value;
0

精彩评论

暂无评论...
验证码 换一张
取 消