How do I add rounds 1, 2,3 on multiple select options i.e. Round 1 + Round 5 as selected on the image below, and display on id="total" which will be 6? I have tried but not getting the idea.
HTML form
<div class="form row">
<select class="selectpicker" multiple data-live-search="true" id="no_of_rounds">
<option value="1">Round 1</option>
<option value="2">Round 2</option>
<option value="3">Round 3</option>
<option value="4">Round 4</option>
<option value="5">Round 5</option>
<option value="6">Round 6</option>
<option value="7">Round 7</option>
<option value="8">Round 8</option>
<option value="9">Pay 1st Round - 8th Round</option>
</select>
<input id="total" type="text">
</div>
Script
<script>
document.querySelector('.form').addEventListener('change', function() {
const nr = +document.getElementById('no_of_rounds').value || 0;
var round_1 = 80;
var round_2 = 90;
var round_3 = 100;
var round_4 = 110;
document.getElementById('total').value = total;
}
}
$('select').selectpicker();
</script>

selectedOptions.DIV.formactually change?changeeventListener on thediv.form? To add to the confusion you have thisHow do I add rounds 1, 2,3 on click rounds or rounds and display on id="total"?. I mean, i personally don't understand what you actually want to do.div.formis used indocument.querySelector('.form').addEventListener('change', function()to fire instant change.