How can I automatically scroll back to the position of the button after submitting my form?
function scrollToButtonPosition(x,y){
window.scrollTo(x,y);
}
How do i call this function and pass the current scroll coordinates when i click the submit button?
You have a few options to achieve that.
a
anchor. Submit form normally to script but append the anchor to the form action URL.Using AJAX would be the best option. But appending an anchor is the easiest to implement.
Fiddle for the anchor: https://fiddle.jshell.net/vaxdu4n7/9/show/