I need in below, when selecting dropdown
it does the calculation automatically without having to click the calcular
button.
Another thing I wanted is: when I checked the checkbox
it multiplied by 2 the total value.
<head>
<script type="text/javascript">
window.onload = function () {
var i = function (id) {
return document.getElementById(id);
}
i("calcula").onclick = function () {
var c1 = i("campo1").value;
var c2 = i("children-qnt").value;
var c3 = i("iv").value;
i("resultado").innerHTML = parseInt(c1) * parseInt(c2) * parseInt(c3);
}
}
</script>
</head>
<body>
<input type="checkbox" id="iv" value="2"/></br>
<input type="text" id="campo1" value="10"></br>
<select name="children-qnt" id="children-qnt">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<div id="children">
<button id="calcula">calcular</button>
Result: <span id="resultado">0</span>
</div>
</body>