Tuesday, March 12, 2013

Add Items(options)to Select box synamicaly using JavaScript

function fill()
{
   
   
    var ddl =document.getElementById("ddl");
    var arrayofMonths=["Jan","Feb","March"];
for (var i=0; i {

   
            var opt = document.createElement('option');
            opt.innerHTML = arrayofMonths[i];
            opt.value = arrayofMonths[i];
            ddl.appendChild(opt);
   
}


Above Code add items to you dropdown list Dynamically,you may use it on your HTML page like Bellow

call this J script function on click event of this button(onclick="fill()")


//
//
////


No comments:

Post a Comment