<!DOCTYPE html>
<html>
<body>
<h1>How to Auto Calculate Price in Javascript</h1>
<form name="frm-pin" method="post" action="pin-index-a.php">
<input type="hidden" name="mode" value="PinRequest" />
<label class="w3-text-green"><b>Number Of Pin</b></label>
<select name="tot_pin_requested" onchange="calculateAmount(this.value)" required>
<option value="" disabled selected>Choose your option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<label><b>Total Amount</b></label>
<input class="w3-input w3-border" name="tot_amount" id="tot_amount" type="text" readonly>
<script>
function calculateAmount(val) {
var tot_price = val * 100;
/*display the result*/
var divobj = document.getElementById('tot_amount');
divobj.value = tot_price;
}
</script>
<body>
</html>