JSFiddle - React, Tailwind, and code Playground
HTML
<select class="sel">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<table>
<tr>
<th>Product</th>
<th class="priceheader" data-taxstate="n">Price (€)</th>
</tr>
<tr>
<td>Apple</td>
<td class="price">10</td>
</tr>
<tr>
<td>Banana</td>
<td class="price">5</td>
</tr>
<tr>
<td>Orange</td>
<td class="price">12</td>
</tr>
</table>
JavaScript
tax = "1.0" //20%
$( ".sel" ).change(function() {
var veiculo = $( ".sel" ).val();
if(veiculo == "saab"){
tax = "1.0";
}else if(veiculo == "mercedes"){
tax = "1.05";
}else if(veiculo == "audi"){
tax = "1.1";
}
if ($(".priceheader").attr("data-taxstate") == "n") {
$(".price").each(function () {
$(this).html(parseFloat($(this).html()) * tax);
});
$(".priceheader").attr("data-taxstate", "y");
}
});