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
DrByte
DrByte13mo ago
Can you add x-init="foo" to your modal component, so "foo" can do its execution?
DarkKnight
DarkKnightOP13mo ago
How? In the blade file?
DrByte
DrByte13mo ago
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.
DarkKnight
DarkKnightOP13mo ago
Maybe someone else knows?
krekas
krekas13mo ago
What do you want to do with js?
DarkKnight
DarkKnightOP13mo ago
I figured it out! I wanted to expand on an already existing plugin Add my own functions and such

Did you find this page helpful?