Sunday, February 23, 2014

Jquery to Populate Drop Down List with Text Box value in ASP.Net

Leave a Comment
In this example I am showing how to populate the drop down list control of with the value entered in a text box control in jquery. In this example there is  a text box in which you enter some text and click on add  button , the value of text box would be appended into drop down list control.

HTML Code to Populate Drop Down List with Text Box Value:

<html xmlns="">
<head runat="server">
<script src="//" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready(function () {
 $('#add').click(function () {
 $('#drplist').append('<option>' + $('#item').val() + '</option>"');
<form id="form1" runat="server">
<asp:TextBox ID="item" runat="server">
<input type="button" name="name" value="add" id="add" />
<asp:DropDownList ID="drplist" runat="server">        


Post a Comment