How to prevent Rails ujs remote form submit from jumping to top of page?

197 Views Asked by At

I have multiple ujs forms on a page, and when clicking submit on the forms lower down on the page, the page jumps back up to the top. All ujs functionality is working correctly, but I'd like the page to stay put after submit. The DOM elements being updated are near the submit button, and not near the top of the page. Is there a way to preventDefault() in the actions js.erb file without wrapping its contents in a function? If not, how can I wrap the js.erb contents in a functions...since I don't need any sort of a lister?

0

There are 0 best solutions below