A
A
Anton89892020-12-17 01:52:44
Vue.js
Anton8989, 2020-12-17 01:52:44

How to alternate clicking checkboxes?

Good day, there is a code example ( jsfiddle.net/v8oa5d69/4 )
How in this example to make it possible to alternately click checkboxes, say if you tick one checkbox, then they will be removed in the other two) Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-12-17
@Anton8989

watch: {
  checked(val) {
    if (val.length > 1) {
      this.checked = val.slice(-1);
    }
  },
},

jsfiddle.net/2gn6z97s
One question - what the hell? You can replace the checkboxes with radio buttons, and add another one that will indicate the absence of a choice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question