I have this code but in the console log I always see “In Prozent angegeben”, maybe define them as constant and do the if else outside of the function?
In the end the scales of a graph have to be adapted to either percentage or absolute values.
<div id="auswahl_id" class = "auswahl_class">
<select id="changeAxisYLabel" onChange = "update()">
<option value ="absoluteValue">Absolute Value</option>
<option value ="percentage">Percentage</option>
</select>
</div>
function update() {
var select = document.getElementById('changeAxisYLabel');
var option = select.options[select.selectedIndex];
let vv = option.value;
let tt = option.text;
console.log(vv);
console.log(tt);
if (vv = "percentage") {
console.log("In Prozent angegeben");
} else if (vv = "absoluteValue") {
console.log("In Zahlen angegeben");
}
}
update();