View Full Version : Quick Question...code loads Select twice?

01-02-2014, 12:20 AM
Greetings, Jan 1st 2013

A brief question, why would the below code load the information twice while it appears to have looped twice. Works great just loads the select box with the same variables twice? The commented line as well works great alone, however, double loads ..any ideas?


for(i = 0; i < 11; i++){
val='test line - '+i;
//document.getElementById("companyspecificmacs").add(new Option(testtxt,testtxt));
var x = document.getElementById("companyspecificmacs");
var option = document.createElement("option");
option.text = 'test line - '+i;
try {
x.add(option, x.options[null]);
catch (e) {
x.add(option, null);


01-02-2014, 06:16 PM
In further discussing the above situation, I have found that an elements state which alters as I devised will call the populate Select box, hence, the routine will continually load each time to appear as multiple loops. the obvious fix, clear the select in the above routine.