so you have managed to recreate radio buttons?
your event listeners are probaby wiped when a dom refresh occurs. You could wire:ignore the checkboxes and send the update to livewire with an event
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have 2 checkboxes, called 'Yes' and 'No'
I want to have it so when one is checked, the other is not, which is achieved with the simple script below.
However, changing the checkboxes in this way makes it so the changes cannot be tracked by wire:model, even after I dispatch an Input Event. How do I resolve this?
yes_checkbox.addEventListener('change', function () {
if (this.checked) {
no_checkbox.checked = false;
no_checkbox.dispatchEvent(new Event('input'));
}
});
no_checkbox.addEventListener('change', function () {
if (this.checked) {
yes_checkbox.checked = false;
yes_checkbox.dispatchEvent(new Event('input'));
}
});
Please or to participate in this conversation.