Initialize custom form component

I have a custom component that has a script for initializing the field, setting up the DOM for the field. I want this field to be hidden by default, but I noticed it's not present in the DOM before it becomes visible. Is there a way to either call the javascript function when it becomes visible, or have the field be present in the DOM?
3 Replies
Dennis Koch
Dennis Koch15mo ago
Probably via Alpine x-data x-init="your JS"
Oliverdam
OliverdamOP15mo ago
Thanks. I'll give it a shot
Oliverdam
OliverdamOP15mo ago
Thanks again, that's exactly what I was looking for.
Want results from more Discord servers?
Add your server