JSFiddle - React, Tailwind, and code Playground
HTML
<select class="box-select" name="level" id="level" onchange="update(this)">
<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 () {
function update(select)
{
// select comes from 'this'
//Ali
var a;
if(select.value = "5")
{
a = 0.1;
}
if(select.value = "10")
{
a = 0.35;
}
var y;
var x = data.value;
y = a * x;
document.getElementById("pricep").innerHTML = "$"+y;
}
});