Conditional hidden field with javascript

Hi I have a field with conditional hidden property
->hidden(fn (Get $get): bool => $get('video_type') != 'file')
->hidden(fn (Get $get): bool => $get('video_type') != 'file')
This is a custom field which need javascript to render the field correctly But the javascript never runs
5 Replies
Dennis Koch
Dennis Koch3mo ago
Maybe share your field implementation
Mohamed Hesham
Mohamed HeshamOP3mo ago
Sure
No description
Mohamed Hesham
Mohamed HeshamOP3mo ago
When I use it without hidden the javascript works
Dennis Koch
Dennis Koch3mo ago
Do you really need that hidden element? Not sure whether Alpine can bind to hidden 🤔
Mohamed Hesham
Mohamed HeshamOP2mo ago
Yes, I need to select where the video is file or a youtube link I did an ugly solution I added a class inside the input called render-me And ran setInterval each 1 second The function renders the input with class render-me then removes that class It worked Hi @Dennis Koch I found another solution I used x-data with x-init for apline.js Thanks
Want results from more Discord servers?
Add your server