-
I have an event function defined in a script tag, and when I click the button, I get a "not defined" error.
What am I doing wrong? I am happy to provide more information if needed. Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
SimoTod
Jan 14, 2025
Replies: 1 comment 2 replies
-
What is the actual error? Why is this function defined like this? Are you calling Alpine.start() in the head of the document? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are inserting the script tag dynamically, you will not be able to call it in that way as a global function.
It's not the way you should do it, your state and functions should be defined in your component, either in x-data or in Alpine.data.