Home » jQuery

Get jQuery option selected | jquery combobox select option

12 August 2012 No Comment
Share on Facebook

Problem: How to get selected option’s key/value of a combobox using jQuery

Solution: It is easy to get jquery select option using $(‘#genderCMB option:selected’).text()

Let us see how to use jQuery option selected to get select option.

jquery select option source

jQuery option selected:

Simple code to get jquery option selected value from combobox.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery combobox selected option</title>
<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">

		alert($('#genderCMB option:selected').text());
		alert($('#genderCMB option:selected').val());

    <select name="genderCMB" id="genderCMB">
        <option value="M">Male</option>
        <option value="F">Female</option>
    <input type="button" id="genderBTN" value="Select Gender" />

jquery select option code explanation:

It is easy get the select option of the combobox in jquery.

$('#genderCMB option:selected').text()

Above jquery gets the option selected from a combobox. same syntax used to get the value of the selected option.

$('#genderCMB option:selected').val()

Code to get the value from a jquery button click

		alert($('#genderCMB option:selected').text());
		alert($('#genderCMB option:selected').val());


We have seen how to get jquery select option, and how to get key & value of combobox using jQuery option selected.

Keywords to here:

  • jquery select selected
  • select option selected
  • option selected jquery
  • jquery select option


We don't share your email anywhere, grab our rss via feedburner