Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to Add items in Drop Down List using Javascript?
Posted

try ..
JavaScript
<script type="text/javascript">
    function AddItem(Text,Value)
    {
        // Create an Option object
 
       
        var opt = document.createElement("option");
        
        // Add an Option object to Drop Down/List Box
        document.getElementById("DropDownList").options.add(opt);
        // Assign text and value to Option object
        opt.text = Text;
        opt.value = Value;
               
    }
<script />
 
Share this answer
 
you must use ajaxcall if you want to bind dropdown with database.
please refer this link for Bind Dropdownlist in ASP.NET using jQuery AJAX[^]
 
Share this answer
 

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



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