<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript">
$(init);
function init(){
$('input[type="range"]').change(getTotal());
}
function getTotal(){
var total = document.getElementById("outTotal");
total.innerHTML = Number(slide.value) + Number(slide1.value0);
}
</script>
</head>
<body>
<input id="slide" type="range" min="1" max="100" step="1" value="10" >
<input id="slide1" type="range" min=1 max=100 step=1 value=10 >
<div>
<label>Total</label>
<output id = "outTotal"></output>
</div>
</body>
</html>
Here's what I have now. I'm trying to total the two range sliders and display when they are changed. I know in the HTML I can add onchange = "getTotal()", but is there a way to have the init() function running all the time. I can't figure out whats wrong with the code in that function.