Get dropdown text in jQuery

Sometime we need to get selected text instead of its value of a dropdown, it is very easy to get dropdown text in jQuery. You have to use text() function of jQuery. It will return the text of option which is currently selected in your dropdown.

$(".ddlCountry option:selected").text()

<!DOCTYPE html>
  <title>jQuery With Example</title>
  <script src="" type="text/javascript"></script>
  <script type="text/javascript">
    $(function () {
      $('.btnClick').click(function () {
        alert($(".ddlCountry option:selected").text());
    <select class="ddlCountry">
      <option value="1">India</option>
      <option value="2">Japan</option>
      <option value="3">England</option>
    <br /><br />
    <input type="button" class="btnClick Button" value="Click" />

No comments :

Please Give Your Feedback