Get and Set Dropdown List Selected Value with jQuery

satinder singh / Updated : / 1 Comments

Dropdownlist Get/Set Value: Get and set drop-down box selected value. In web pages while form submission many time we commonly use drop-down list, this post explains how to get / fetch dropdown list selected value. In jQuery we get drop-down list selected by using .`val()` method. The .val() method is primarily used to get the values of form elements such as input, select and text area.

Description: Get the current value of the first element in the set of matched elements.


<select id="myDlist">
        <option value="1">one</option>
        <option value="2">two</option>
        <option value="3">three</option>
        <option value="4">four</option>

 jQuery: Here the jQuery code by using .val() method we get the id /value of selected drop-down list,

   // Get the value from a dropdown select
   $('#myDlist option:selected').val();

2nd and easier way

   // Get the value from a dropdown select even easier

Try it Yourself »

Hope you enjoyed this tutorial. If you have any recommendations, please let us know what you think in the comment section below! See you again next time!



One comment on “Get and Set Dropdown List Selected Value with jQuery”

  1. mehmet

    i have a senario, suppose that you stored some records and it gotten 8country and state from dropdown) with name, surname..when you need a recordscode should invoke the saved records and bind name, surname (country and state = in dropdown)

Post Comment

Your email address will not be published. Required fields are marked *