views:

77

answers:

2

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. What else to use to get the DropDown selected text?

+2  A: 

this.options[this.selectedIndex].value

Tor Valamo
.. or use jQuery's `$(this).val()`.
BalusC
@BalusC - that's assuming you use jQuery, which doesn't really answer the question.
Tor Valamo
This was more towards the OP, not to you :) Do I have to remove my upvote on your answer?
BalusC
I upvoted your answer about hiring a webdesigner, so it seems we have a mexican standoff. :P
Tor Valamo
+1  A: 
var i = this.selectedIndex;
var selectedText = this.options[i].text;

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

Mef