You don't need to set the checked property. Just a boolean is needed for the model bound to the checkbox.
v-on:click="checkedColors = true"
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Please see the code below. In there, I use Laravel blade syntax to loop over an array of checkboxes. Next to each checkbox is a button. The idea is that when you click the button, the checkbox must become checked.
<div class="panel-body">
@foreach($colors as $color)
<input type="checkbox" id="{{ $color->id }}" value="{{ $color->name }}" v-model="checkedColors" v-bind:id="checkedColors">
<input type="button"
style="background-color:{{ $color->code }};color:{{ $color->font or 'white' }}"
value="{{ $color->name }}" title=""
v-on:click="checkedColors.checked = true"
>
@endforeach
</div>
At present nothing happens. I've tried various combinations but I still can't get it right. I guess I am missing something fundamental. Please assist.
You don't need to set the checked property. Just a boolean is needed for the model bound to the checkbox.
v-on:click="checkedColors = true"
Please or to participate in this conversation.