Closed pandermatt closed 2 years ago
I'm not 100% sure of this, but I think it should be $('html').on('turbo:render', ...)
. The events are emitted on the <html>
element of the document, not the document itself.
Sadly, this also emits no event. I also tried other events, but none are triggered.
I really have no control over this, it is all handled by the turbo library.
I did a quick test to confirm that events are dispatched, and they are. I added the following to my "todos" example:
<script>
document.addEventListener('turbo:submit-start', () => console.log('submit-start'));
document.addEventListener('turbo:submit-end', () => console.log('submit-end'));
</script>
These work fine, so it is not a dispatching problem. My guess is that the event doesn't fire because it isn't supposed to fire in the situation you are in. I suggest asking on Stack Overflow or a hotwired forum.
Thank you very much!
Hello
This will result in no output, but the content of the website changes. Are there any other events to use upon a replace?
Thanks