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

0RuiAlvel0's avatar

Add e.preventDefault() to generated JS

Hi all.

New to livewire. Currently implementing the classic loading of a table data dynamically with pagination and all is going well except that when I click the page numbers, the page jumps up to the top before dynamically reloading the table.

In the old days when I had to write JS, I would add the preventDefault() method to the top of the handler code to prevent that from happening. How would I go about doing that with livewire and keeping the page from jumping to the top?

TIA, Rui

0 likes
4 replies
Snapey's avatar

You don't, there is no such thing.

Make sure that you are using Livewire's pagination.

0RuiAlvel0's avatar

yes, I'm using Livewire's pagination. thank you for the reply, Livewire may not be for me.

Please or to participate in this conversation.