[英]Get <select> text using 'this' keyword
I am using following code: 我使用以下代码:
<select class="element select medium" id="inDistrict"
name="inDistrict" onchange="setCookie('lastvalue',this.value,1);">
It is not taking: this.value. 它没有采取:this.value。 What else to use to get the DropDown selected text?
还有什么可用于获取DropDown选定的文本?
var i = this.selectedIndex;
var selectedText = this.options[i].text;
Should do it (if this is the correct context). 应该这样做(如果这是正确的上下文)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.