0

I would like to disable the scrolling upon clicking a submit button placed in a submission form while I still want to get PHP's email forwarding functionality associated with the button working.

I read this article and verified that the use of preventDefault() disables both the default behaviour of the submit button and the PHP code associated with the button:

How do i stop a page from scrolling to the top when button clicked in php?

Please someone advise me how to achieve the both.

1 Answers1

0

First you just need to add a function like

form.onsubmit = function()
{
   // disable scroll code, see link below
};

here's a good answer how to disable the mouse scroll and other keys:

How to disable scrolling temporarily?

Mark
  • 35
  • 7