I have group of checkboxes:
<div class="additions">
<input type="checkbox" value="10" v-model="additional">
<input type="checkbox" value="30" v-model="additional">
<div class="group">
<input type="checkbox" value="50" v-model="additional">
<input type="checkbox" value="70" v-model="additional">
</div>
</div>
I collecting checked values to data:
new Vue({
el: '#app',
data() {
return {
additional: [],
}
},
});
Can't figure out how to prevent checking more then 1 checkbox inside .group I tried using radio, but then stranger things come up, decided to stick with checkboxes. I could do it in jQuery or even vanilla JS I think, but I don't know where to put check (on change event method?). What is the best way to do it in VueJS?
Here is my pen: https://codepen.io/RomkaLTU/pen/LXOJgr?editors=1010
type="radio"rather thantype="checkbox"?