I think this is really easy, but I just can't get it to work.
I want my button to say different things when a different option is selected.
I tried this:
<select id="selector123">
<option>test</option>
<option>tes2</option>
</select>
<br><br>
<button onclick="test()">hoi</button>
<script>
var e = document.getElementById("selector123");
var strUser =
e.options[e.selectedIndex].value;
function test() {
if (strUser =
"test") {
alert('this should a different text');
} else if (strUser = "tes2") {
alert('this should say this text');
}
}
</script>
But its not working.
Maybe know what I'm doing wrong?