Home > Uncategorized > Javascript for copying a drop down list

Javascript for copying a drop down list

I found this nifty piece of javascript handy for copying the contents of one drop down list into another

function copyDropDownList(source,destination)

 for(i=0;i<source.options.length;i++)
 {
  optionText = source.options[i].text;
  optionValue = source.options[i].value;
  destination.add(new Option(optionText,optionValue));
 }
}

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment