How to add option to drop down list using jQuery

For add option using jQuery you can use below HTML and jQuery code.

      <title>How to add option to drop down list</title>
      <script src=""></script>
      <style type="text/css">
         #text {
         margin-top: 20px;
      <script type="text/javascript">
         	var as = $("#addtext").val();
         	if(as != ""){
         	$('.DropDown').append($('<option></option>').val(as).html(as).attr('selected', 'selected'));
         		alert("Write Text In Textbox");
      <div class="dd">
         <select class="DropDown">
            <option value="Value 1">Value 1</option>
            <option value="Value 2">Value 2</option>
         <button class="addoption">Click to add option</button>
      <div id="text" style="display: none">
         <table cellpadding="0" cellspacing="0">
                  <label> ADD TEXT</label>
                  <input type="test" id="addtext" value=""/>
                  <input type="button" value="Add"  class="Button1"/>

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s