Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jeroenvanrensen's avatar

Livewire: run JS on page update

Hello everyone,

Every time Livewire updates the page (after a server request), I want to execute some JavaScript.

I can't however figure out which hook to use.

I tried using the function $this->js(), but that function calls the javascript before the page gets updated. I need to run the javascript code after the dom updates are done.

I also can't use the Livewire.hook('request', ...) method for the same problem as $this->js().

Thank you in advance!

0 likes
4 replies
jeroenvanrensen's avatar
Level 15

Thanks for your answer, but that doesn't quite work.

I found the answer: wrap the function in a timeout call, so: $this->js('setTimeout(renderMath)');

nickrushuniq's avatar

Hi! Do you have any solutions for this problem? I think solution with "setTimeout" function is not correct, because i don't now how many time wiil be render html

Please or to participate in this conversation.