Monday, 11 January 2016
Get Dropdownlist Text and Value From Client Side Using Jquery in ASP.NET,C#
Here explaination about using jquery to get asp.net DropDownList value or text using jquery Change() event.If you select a option from dropdownlist you get alert box with text or value.
Using jquery change() event in asp.net get an value easily without postback.
Using jquery change() event in asp.net get an value easily without postback.
ASP.Net Code :
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
<asp:ListItem Text="Individual" Value="I"></asp:ListItem>
<asp:ListItem Text="Family" Value="F"></asp:ListItem>
</asp:DropDownList>
jQuery Code :
$(document).ready(function () {
$("[id*=ddlType]").change(function () {
var value = $("[id*=ddlType] option:selected").val();
or
var text = $("[id*=ddlType] option:selected").text();
alert(value);
});
});
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment