Question: How can I without the innerHTML to make the same result as the HTML file show Javascript Form Select Change Options Dynamic List Elements This
How can I without the innerHTML to make the same result as the HTML file show
"Javascript Form Select Change Options Dynamic List Elements"
This is the HTML file
function populate(s1,s2){
var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2);
s2.innerHTML = "";
if(s1.value == "Chevy"){
var optionArray = ["|","boston|Boston Celtics","chicago|Chicago Bulls","miami|Miami Heat"];
} else if(s1.value == "Dodge"){
var optionArray = ["|","los|Los Angeles Lakers","golden|Golden State Warriors","Cleveland Cavaliers"];
} else if(s1.value == "Ford"){
var optionArray = ["|","mustang|Mustang","shelby|Shelby"];
}
for(var option in optionArray){
var pair = optionArray[option].split("|");
var newOption = document.createElement("option");
newOption.value = pair[0];
newOption.innerHTML = pair[1];
s2.options.add(newOption);
}
}
Choose Your favorite NBA Team
Choose The Location Of The NBA Team:
Choose Your favorite team:
Choose Your Favorite NBA Player In This Team:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
