I have 2 code,
This is the First:
$("#Button1")
.click(function () {
var index;
var select = $("#DropDownList1");
var select = document.getElementById("DropDownList1");
var myindex = ["zero", "one", "two", "three"];
for (index = 0; index < myindex.length; index++) {
select.appendChild(new Option(myindex[index]));
}
});
This is the Second:
$("#Button1")
.click(function () {
var index;
var select = document.getElementById("DropDownList1");
var myindex = ["zero", "one", "two", "three"];
for (index = 0; index < myindex.length; index++) {
select.appendChild(new Option(myindex[index]));
}
});
Why the first code doesn't work?
var select = $("#DropDownList1");
I have to change it to
var select = document.getElementById("DropDownList1");
I want to turn $("#DropDownList1") to a variable.