简体   繁体   中英

How to get the Default value of Dropdown when loaded

I have a dropdown and it has only one value for time being. So I am not able to use:

  $('#dropDown1').change

But what I want to do is get the default value and pass this to another jquery function.

I tried using $('#dropDown1').click but not what I am looking at .

you can get like this:

Html:

<select id="dropDown1">
<option value="1">One</option
</select>

Jquery:

$(document).ready(function(){

    var val = $('#dropDown1').val();

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM