How to populate a form list with buttons using javascript
- by StealingMana
I made a script that, when you press one button(accessories) the selection(mylist) populates with one array(accessoryData), and when you hit the other button(weapons) the other array(weaponData) populates the selection. However, in the current state of the code the second button press is not re-populating the selection. What is wrong here?
Also if there is a more efficient way to do this, that might be helpful.
Full code
function runList(form, test) {
var html = "";
var x;
dataType(test);
while (x < dataType.length) {
html += "<option>" + dataType[x];
x++;
}
document.getElementById("mylist").innerHTML = html;
}