Pages

Friday, March 23, 2012

how to add remove items in dropdown list in java script

how to add remove items in dropdown list in java script in asp.net


it is very easy to add and remove items in javascript .

Here is the code for it...



<script type="text/javascript">
    function AddItem(Text,Value)
    {
        // Create an Option object for adding item to dropdownlist       
        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 />


Enjoyyyy Programming..

No comments:

Post a Comment