开发者

How to get the selected value from a asp:DropdownList using jQuery

开发者 https://www.devze.com 2023-01-11 00:55 出处:网络
I have the following code and it gives me the text but not the value. What is wrong and how do I fix it?

I have the following code and it gives me the text but not the value. What is wrong and how do I fix it?

 function pageLoad() {
       $('#<%=dpEmploymentStatus.ClientID%>').change(function() {

       alert($('#<%=dpEmploymentStatus.ClientID%>' + ' option:selected'开发者_如何学JAVA).text());


       }).change();
   }


Use val() instead of text().

0

精彩评论

暂无评论...
验证码 换一张
取 消