I am currently trying to change the color of a -element using JavaScript, with the help of the DOM-event "onchange".
function changeColor() {
var myHeader = document.getElementById("header");
var mySelect = document.getElementById("select");
header.style.color = mySelect.value;
}
<h4 id="header">This is my header!</h4>
<form>
<select id="select" name="select" onchange="changeColor()">
<option value="black">Black</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="yellow">Yellow</option>
</select>
</form>
I think the problem is on the last line of code inside of the function. Please help a friend out!