开发者

Get <select> text using 'this' keyword

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜