Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
<asp:DropDownList ID="ddl" runat="server"  ClientIDMode="Static"  OnSelectedIndexChanged="ddl_SelectedIndexChanged"></asp:DropDownList>
<asp:Label ID="label" runat="server" ClientIDMode="Static" CssClass="field" Width="150px"></asp:Label>

<script type="text/javascript">
     $(function () {
         $("#ddl").change(function (e) {
             var itemExists = false;
             var txt = $("#label").val();
             e.preventDefault();
             $("#ddl option").each(function () {
                 if ($(this).text() == $.trim(txt)) {
                     itemExists = true;
                     alert('Item already exists');
                 }
             });
         });
     });
</script>   
Posted
Comments
KaushalJB 24-Jun-15 2:52am    
What is the issue in code ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900