<html xmlns="
http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%=DropDownList1.ClientID %>').bind("keyup change", function () {//use bind() to attach a handler to the keyup and change events:
$('#message').text("");
if ($(this).val() != "") {//Check if the selected value of the DropDownList is empty
$('#message').text("Text:" + $(this).find(":selected").text() + "value:" + $(this).val()); //Retrieve the Text/Value pair and display in the div area 'message':
}
else {
$('#message').text("");
}
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="" Text="please select"></asp:ListItem>
<asp:ListItem Value="1" Text="Standard"></asp:ListItem>
<asp:ListItem Value="2" Text="Silver"></asp:ListItem>
<asp:ListItem Value="3" Text="Gold"></asp:ListItem>
<asp:ListItem Value="4" Text="Premier"></asp:ListItem>
</asp:DropDownList>
</div>
<div id="message"></div>
</form>
</body>
</html>
<head runat="server">
<title></title>
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%=DropDownList1.ClientID %>').bind("keyup change", function () {//use bind() to attach a handler to the keyup and change events:
$('#message').text("");
if ($(this).val() != "") {//Check if the selected value of the DropDownList is empty
$('#message').text("Text:" + $(this).find(":selected").text() + "value:" + $(this).val()); //Retrieve the Text/Value pair and display in the div area 'message':
}
else {
$('#message').text("");
}
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="" Text="please select"></asp:ListItem>
<asp:ListItem Value="1" Text="Standard"></asp:ListItem>
<asp:ListItem Value="2" Text="Silver"></asp:ListItem>
<asp:ListItem Value="3" Text="Gold"></asp:ListItem>
<asp:ListItem Value="4" Text="Premier"></asp:ListItem>
</asp:DropDownList>
</div>
<div id="message"></div>
</form>
</body>
</html>