Alex Rivera | Logout

How to get Javascript Select box's selected text

Asked 2010-07-03T07:11:51.987
83

This things works perfectly

<select name="selectbox" onchange="alert(this.value)">

But I want to select the text. I tried in this way

<select name="selectbox" onchange="alert(this.text)">

It shows undefined. I found how to use DOM to get text. But I want to do this in this way, I means like using just this.value.

Edit
Report

1 Answer

37

Please try this code:

$("#YourSelect>option:selected").html()
answered 2013-06-15T15:12:18.007

Your Answer