S
soni2926
hi,
I'm trying to add some values to a dropdown list via javascript, but i
keep getting this error:
sControl.options is undefined
here is the code below:
var sControl = document.getElementById
('ctl00_ContentPlaceHolder1_ddl2');
var totalSize = result.length;
var opt = document.createElement("option");
for (var i = 0; i < totalSize; i++) {
sControl.options.add(opt);
opt.text = "something";
opt.value = "123";
}
if i use firebug (firefox js debugger plugin) it shows that it picks
up sControl as type select-one, am i adding it wrong to the
dropdownlist?
I'm trying to add some values to a dropdown list via javascript, but i
keep getting this error:
sControl.options is undefined
here is the code below:
var sControl = document.getElementById
('ctl00_ContentPlaceHolder1_ddl2');
var totalSize = result.length;
var opt = document.createElement("option");
for (var i = 0; i < totalSize; i++) {
sControl.options.add(opt);
opt.text = "something";
opt.value = "123";
}
if i use firebug (firefox js debugger plugin) it shows that it picks
up sControl as type select-one, am i adding it wrong to the
dropdownlist?