php - How to return to original scroll position after submitting a form using javascript? -


how can automatically scroll position of button after submitting form?

function scrolltobuttonposition(x,y){   window.scrollto(x,y); } 

how call function , pass current scroll coordinates when click submit button?

you have few options achieve that.

  • use ajax submit form script. scroll position maintained
  • on submit save scroll position local storage , on load if item in local storage, if scroll , delete item in local storage. if not, page didn't loaded due form submission.
  • using a anchor. submit form script append anchor form action url.

using ajax best option. appending anchor easiest implement.

fiddle anchor: https://fiddle.jshell.net/vaxdu4n7/9/show/


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -