JSFiddle - React, Tailwind, and code Playground
by j08691
HTML
<select class="box-select" onchange="update(this)" name="level" id="level">
<option value="5">Level 5</option>
<option value="10">Level 10</option>
</select>
<!-- a lot of code --> <span class="box-label" id="pricep">0 USD</span>
JavaScript
function update(data) {
//Ali
var a;
if (document.getElementById("level").value == "5") {
a = 0.1;
}
if (document.getElementById("level").value == "10") {
a = 0.35;
}
var y;
var x = data.value;
y = a * x;
document.getElementById("pricep").innerHTML = "$" + y;
}