Exp 14
Exp 14
Experiment No. 14
<select id="secondSelect"></select>
<script>
var secondSelectOptions = {
1: ["Suboption 1a", "Suboption 1b", "Suboption 1c"],
2: ["Suboption 2a", "Suboption 2b", "Suboption 2c"],
3: ["Suboption 3a", "Suboption 3b", "Suboption 3c"]
};
document.getElementById("firstSelect").addEventListener("change", function()
{
var selectedValue = this.value;
document.getElementById("secondSelect").innerHTML = "";
secondSelectOptions[selectedValue].forEach(function(suboption) {
var option = document.createElement("option");
option.value = suboption;
option.textContent = suboption;
document.getElementById("secondSelect").appendChild(option);
});
});
</script>
<menu id="myMenu">
<li><a href="#">Copy</a></li>
<li><a href="#">Paste</a></li>
<li><a href="#">Cut</a></li>
</menu>
</body>
</html>