Hey everyone,
I have been racking my brain over this for far too long and decided to reach out for some help. I am creating a form that allows me to do a budgetary quote for network cabling. What I am trying to achieve is that when I select either Cat5e or Cat6 the price per run of cable changes. Here is my code below:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Budgetary Cabling Quote Form</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type='text/javascript'>
$(document).ready(function() {
$(".input").keyup(function() {
var val1 = +$(".value1").val();
var val2 = +$(".value2").val();
var val3 = +$(".value3").val();
var one = val1 * 155;
var two = val2 * 280;
var three = val3 * 385;
$("#result").val(val1 + val2 + val3);
$("#result0").val(one + two + three);
});
});
</script>
</head>
<body>
<form>
<select name="category">
<option value="155|280|385">Cat5e</option>
<option value="177|310|420">Cat6</option>
</select>
<br>100ft<br>
<input type="text" class="input value1">
<br>200ft<br>
<input type="text" class="input value2">
<br>300ft<br>
<input type="text" class="input value3">
<br>Total Lines<br>
<input type="text" disabled="disabled" id="result">
<br>Total Price<br>
<input type="text" disabled="disabled" id="result0">
</form>
</body>
</html>