Custom events with underscores do not work, right? #3023
-
When I use Is this a limitation of alpine.js or a general JavaScript/web limitation? Cheers! 🙏🏼 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You cannot add event handler in HTML with underscores _ as it will not compile. I would recommend not to create event-types with underscores as it may not even be supported from javascript in future releases |
Beta Was this translation helpful? Give feedback.
-
This was just merged and released, in case you didn't see |
Beta Was this translation helpful? Give feedback.
You cannot add event handler in HTML with underscores _ as it will not compile.
However, you can do it through JS of parent component:
If you want to handle an event in HTML of parent, you should directly add prefix in attribute on event.
I would recommend not to create event-types with underscores as it may not even be supported from javascript in future releases