Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically merge elements #88

Open
ryands17 opened this issue Aug 15, 2024 · 3 comments
Open

Programmatically merge elements #88

ryands17 opened this issue Aug 15, 2024 · 3 comments

Comments

@ryands17
Copy link

I wanted to know if alpine-ajax supports morphing of elements from JS directly i.e. A JS API to do that from a script tag

@imacrayon
Copy link
Owner

Alpine AJAX simply uses Alpine Morph. Alpine Morph is a single function that doesn’t have a dependencies, so you should be able to import it and use it where you need to.

@ryands17
Copy link
Author

Does morph support options like Alpine-Ajax does, like appending to an element instead of entirely replacing it?

I would love if alpine-ajax expose the function that does this.

@imacrayon
Copy link
Owner

Ah, sorry, we don't have anything like that at the moment - but I'm looking into refactoring some things and exposing some of those core functions soon! In the meantime you can have a look at the merge method in the code to get an idea how you could build implement something yourself: https://github.com/imacrayon/alpine-ajax/blob/main/src/index.js#L497-L534

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants