I have the following code:
<select id="SubjectID"><option value='00'>Select Subject</option>
<option value=01 selected='selected'>Software</option>
<option value=02>Psychology</option>
<option value=03>Database</option>
</select>
I use $(‘#SubjectID’).val() to get the value such as “01”.
How can I get the text of the selected option with jquery?
You can select the selected option with the
:selectedpseudo-selector (how many times can you use the word “select” in one sentence?!), and use thetextmethod to get the text: