Skip to content
Advertisement

Get the list of all selected check boxes with Vue.js

How can I get a list of all check boxes that I selected with Vue? This is my HTML which works and shows me a list of my products with a checkbox.

JavaScript

What I want is that when I click on a button, it fetches all check boxes that I selected. And give me all the values. But I can’t figure out how to do it, because it’ll break when I even try to add a v-model to the checkbox.

Advertisement

Answer

Just bind every checkbox value with a product and the v-model to the array checkedProducts

JavaScript
Advertisement