How do I execute Alpine code when clicking on a modal?
As the title says, I want to execute some custom alpine code, or at the very least some plain JS code in general. Is that possible, if so, how?
6 Replies
Can you add x-init="foo" to your modal component, so "foo" can do its execution?
How? In the blade file?
Yes. I had to do that for a custom component I was making (a clone of an existing component with altered functionality), in order to fire JS from an external script.
Not sure if any/many Filament components allow attaching x-init to them without overriding them.
Maybe someone else knows?
What do you want to do with js?
I figured it out!
I wanted to expand on an already existing plugin
Add my own functions and such