Let me simplify the issue:
I have a checkbox in my Vue.js template (using Vuetify components):
<v-checkbox
v-model="selected"
label="John"
value="John"
id ="john"
@click.native="checkit">
</v-checkbox>
The checkit()
method code is:
checkit: function() {
let elt = document.getElementById('john')
if(elt.checked) {
console.log('checked')
} else {
console.log('unchecked')
}
}
But I am getting the opposite result: when it is checked it says it is unchecked and vice versa.
What causes this and how to fix it?