On several of my pages, I have a table with a form below it to add entries to the table. Once the form is submitted, it is set to reload. When the form is submitted, the page scrolls down to the form, so the user cannot see the information added to the table in the prior submission without scrolling up.
I am trying to use java to scroll back to the top of the page upon form submission. I wrote the code below (I'm an amateur at this) that causes the page to scroll back to the top after the form is submitted, but then the page scrolls down to the form again.
Any ideas on how to stop this? THANKS!
$(document).on('knack-view-render.any', function(event, view, data) { $(".kn-submit input[type=submit]").on("click", function() { $('html, body').animate({ scrollTop: 0 }); }); });