I'm running into trouble trying to automatically change the text in two div tags on a page when selecting an item from Semantic UI's dropdown. I'm not sure where I'm going wrong. I made a javascript function that should be targeting the dropdown and retrieving values from there.
Here's the HTML code
<h2 class="sTypeText">Undefined</h2>
<span class="annotation">
You've selected <b class="sTypeText">undefined</b> mode. You can continually edit this mode and its details.
</span>
<div id="dropdown" class="ui fluid selection dropdown" onchange="changeSelect">
<div class="text">Choose Type</div>
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" data-value="A">Assessment</div>
<div class="item" data-value="G">Group</div>
<div class="item" data-value="S">Solo</div>
</div>
</div>
Here's the Javascript code:
function changeSelect() {
if (document.getElementById("dropdown").data-value == "A") {
document.getElementByClassName("sTypeText").innerHTML = "Assessment";
} else if (document.getElementById("dropdown").data-value == "G") {
document.getElementByClassName("sTypeText").innerHTML = "Group";
} else if (document.getElementById("dropdown").data-value == "S") {
document.getElementByClassName("sTypeText").innerHTML = "Solo";
}
}