开发者

Get <select> text using 'this' keyword

开发者 https://www.devze.com 2022-12-15 18:36 出处:网络
I am using following code: <select class=\"element select m开发者_JS百科edium\" id=\"inDistrict\"

I am using following code:

<select class="element select m开发者_JS百科edium" id="inDistrict"
        name="inDistrict" onchange="setCookie('lastvalue',this.value,1);">

It is not taking: this.value. What else to use to get the DropDown selected text?


this.options[this.selectedIndex].value


var i = this.selectedIndex;
var selectedText = this.options[i].text;

Should do it (if this is the correct context).

0

精彩评论

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