I have a simple form that loops some select elements from the server. In this case, I want to sum every option value that selected and not the disabled one and show the calculation of these values into the input value every time when the user change the value inside it. How is it work with onchage event. Thanks in advance.
HTML Code Example
<form>
<div class="form-group">
<select class="1 presence-value form-control" name="presence-value" required>
<option value="">-- Select--</option>
<option value="1" selected>Full</option>
<option value="0.5">Half</option>
<option value="0">None</option>
</select>
</div>
<div class="form-group">
<select class="1 presence-value form-control" name="presence-value" required>
<option value="">-- Select--</option>
<option value="1" selected>Full</option>
<option value="0.5">Half</option>
<option value="0">None</option>
</select>
</div>
<div class="form-group">
<select class="2 presence-value form-control" name="presence-value" disabled required>
<option value="">-- Select--</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0" selected>None</option>
</select>
</div>
<div class="form-group">
<select class="2 presence-value form-control" name="presence-value" disabled required>
<option value="">-- Select--</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0" selected>None</option>
</select>
</div>
<input type="number" value="0" required>
<button type="submit">Submit</button>
</form>