jaeger
jaeger

Reputation: 1

Select box option add works in IE but not Firefox

In Firefox the "alert("backupopt2="+backupopt);" does not execute i.e. there appears to be a problem with "backupelement.add(backupopt);". Nothing on the Java console. Assistance appreciated; thanks.

for(i = 0; i < backupresponsesplit.length; i++)
       {
         var backupopt = document.createElement("OPTION");
         var backupelement = document.getElementById("metarecords");
         backupopt.text = backupresponsesplit[i];
         backupopt.value = backupresponsesplit[i];
         alert("backupopt1="+backupopt);
         backupelement.add(backupopt);
         alert("backupopt2="+backupopt); 
       }

<select size="3" id="metarecords" style="width:845; height:54; font-family:monospace" onChange="ajaxMeta();">
</select>

Upvotes: 0

Views: 434

Answers (1)

Adithya Surampudi
Adithya Surampudi

Reputation: 4454

Assuming metarecords id belongs to a select tag instead of 'add' try this

backupelement.appendChild(backupopt);

Upvotes: 1

Related Questions