Question
How can change the code no need innerHTML, innerText, etc . And to make the same result as the HTML file show you can change
How can change the code no need innerHTML, innerText, etc. And to make the same result as the HTML file show
you can change the all code if you want
do not use jQuery or the any source you can use json file to save the data
"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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started