Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Assigning selected value in combo box from javascript

800409Jul 28 2005 — edited Aug 1 2005
I'm dynamically building a table. One of the the things I'm adding is a combo box... This combo box is a clone of an already existing hidden combo box. here is the code I use to clone it, but I don't know how to change the value in javascript.

*1 is the line where I am trying to set the selected value. selected source is equal to the value I want to have selected... can anyone point out what I'm doing wrong? what attribute should I be setting.
var cellSecond = row.insertCell(1);
var myElement = document.getElementById('sourceBase');
var el = myElement.cloneNode(true);
el.setAttribute('selected',selectedSource);    //*1
el.setAttribute('name','e_source');
cellSecond.appendChild(el);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2005
Added on Jul 28 2005
7 comments
415 views