Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

itechsystemsolutions's avatar

Vue js event for checking a checkbox.

I want to trigger a function when a checkbox is checked and is unchecked... what can i do about this? something like v-on:click...

0 likes
4 replies
camerongrant's avatar
<input  type="checkbox" @click="somefunction">

Some function would live in the methods object.

1 like
kfirba's avatar
kfirba
Best Answer
Level 50

@greenroofcorp well yeah, you can use the click event or the change event. It would look like:

<input type="checkbox" @click="checkboxToggle">

Now just define that checkboxToggle method in your Vue instance and it should be triggered each time you click the checkbox. You can replace the click event with change event if you want.

6 likes

Please or to participate in this conversation.