-
I have a DOM element with an attribute that is added/removed by an external library (e.g. bootstrap). Before: <div x-data="{ fooEnabled: false }">
...
</div> After: <div x-data="{ fooEnabled: false }" data-foo="123">
...
</div> I'd like to toggle This can be done with a mutation observer, but I'm hoping it's possible (and easier) using alpinejs. How do I do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
With alpine, you'd still use a mutation observer. Alpine has some helpful methods that might help, I think it's |
Beta Was this translation helpful? Give feedback.
With alpine, you'd still use a mutation observer.
Alpine has some helpful methods that might help, I think it's
Alpine.onAttributeAdded
, but probably easily to slap a mutation observer inside an init. Just observe the same element and toggle the thing.