JSFiddle - React, Tailwind, and code Playground
by 3rror404
HTML
<script>
var moneyprice = new Array();
moneyprice["loon"] = 1;
moneyprice["toon"] = 2;
function moneyTotal() {
var mons = 0;
var frm = document.forms["moneyform"];
var selectedMoney = frm.elements["money"];
mons = moneyprice[selectedMoney.value]
return mons;
}
function calculateTotal() {
var total = moneyTotal();
document.getElementById("pg").innerHTML = total;
}
</script>
<form id="moneyform" name="moneyform">
<fieldset>
<select id="money" name="money" onchange="calculateTotal()">
<option value="loon">1 dollar</option>
<option value="toon">2 dollar</option>
</select>
<br>
<p id="pg"></p>
<input type="text" onselect="textSelected()">
</fieldset>
</form>