Home > Article > Web Front-end > How to Retrieve Specific `` Text in jQuery?
Retrieving Specific
This article addresses the challenge of obtaining the text content of a particular
<code class="html"><select id='list'> <option value='1'>Option A</option> <option value='2'>Option B</option> <option value='3'>Option C</option> </select></code>
Getting
To retrieve the text of an
<code class="javascript">$("#list option[value='2']").text();</code>
In this example, we're targeting the
Getting Text of Selected
If you wish to obtain the text of the currently selected
<code class="javascript">$("#list option:selected").text();</code>
This selector will return the text of the
The above is the detailed content of How to Retrieve Specific `` Text in jQuery?. For more information, please follow other related articles on the PHP Chinese website!