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).
精彩评论