Alternative to jQuery .empty() #4315
Replies: 4 comments 3 replies
-
Normal Javascript. Replace an elements children: Replace an element: 99.9% of what jquery could do is already really simple to do in plain javascript. for your specific example, I'd jsut use Key the x-for to the actual value inside. then the x-for will remove and create the new ones for that widget to see. |
Beta Was this translation helpful? Give feedback.
-
the error has nothing to do with the question though. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for your quick and top support guys! I actually ended up changing the iframe url directly. |
Beta Was this translation helpful? Give feedback.
-
PS: You can see the result on https://matchflix.ch/ now 😊 Just click any movie or show... |
Beta Was this translation helpful? Give feedback.
-
I'm using a widget that needs to be re-initialized once the input data changes. In jQuery I used
$container.empty().append($widget);
to do that. Now with AlpineJS I struggle to do so. In the console there is this error message:So, is there a way to make this work, i.e. remove an initialized widget completely, in order to re-initialize it again differently?
https://codepen.io/simonferndriger/pen/yLdJjyP
Beta Was this translation helpful? Give feedback.
All reactions