below in my Vue JS code, i wanted to sum input data if it's checked in checkbox only, for ex (sum input entered by user instTwo + instThr if they're checked only) and if it's not checked it shouldn't be sum
is there a way in Vue JS to sum data below if it's checked only ?
data() {
return {
checkPayment: true,
checkPayment2: true,
checkPayment3: true,
checkPayment4: true,
}},
<p> amount No.1 </p>
<div class="inst-input justify-content-center mt-3">
<input v-model="instTwo" class="paid-input" required />
<b-form-checkbox id="checkboxs-2" v-model="checkPayment" name="checkbox-2" unchecked-value="false">
</b-form-checkbox>
</div>
<p> amount No.2 </p>
<div class="inst-input justify-content-center mt-3">
<input v-model="instThr" class="paid-input" required />
<b-form-checkbox id="checkbox" v-model="checkPayment2" name="checkbox-1" unchecked-value="false">
</b-form-checkbox>
</div>
<p> amount No.3</p>
<div class="inst-input justify-content-center mt-3">
<input v-model="instFour" class="paid-input" required />
<b-form-checkbox id="checkbox" v-model="checkPayment3" name="checkbox-1" unchecked-value="false">
</b-form-checkbox>
</div>
<p> amount No.4 </p>
<div class="inst-input justify-content-center mt-3">
<input v-model="instFive" class="paid-input" required />
<b-form-checkbox id="checkbox" v-model="checkPayment4" name="checkbox-1" unchecked-value="false">
</b-form-checkbox>
</div>