Hi all:
Is there any problem with loading the same set of values in 2 different HTML form dropdowns? My code looks like this:
var dr1=document.getElementById("dr1");
var dr2=document.getElementById("dr2");
for (nombre in elements) {
var opcion=document.createElement('OPTION');
var cam=elements[nombre];
opcion.value=nombre;
opcion.text=cam["nombreCompleto"];
//Añadimos a los 2 dropdowns
dr2.add(opcion, null);
dr1.add(opcion, null);
}
dr1.selectedIndex=0;
dr2.selectedIndex=0;
This load the same set of values to two different dropdowns. However, when executed, it only loads whatever dropdown appears last in the code; in the above example, it would have been "dr1" (and if I put the "dr2.add(option.null)" line last, it loads that one). If I load only one dropdown (commenting out the other one) it works fine.
All of this is on Firefox 3.6.10.