How to reset Web Page to its Initial State When a back arrow is pressed in web browser?

Hi there

I have question that when a user press a back arrow after submitting from to a server then all value that are send to server using post method are also there on Input Fields I want those value should be clear and web page will be reset to its Initial State when it is run first time.

How do I acheive this?

Thanks

Perhaps on page load you can manually set the elements to ‘’ in jQuery. There was a recent thread on this but I can’t seem to find it.

@RyanReese

You are right something like this work for me

  function resetPage() 
  {$('#register_form').get(0).reset(); }window.onload = resetPage;

Why do you asking same question again?

1 Like

I believe that you when you use the back arrow key the js you posted won’t get triggered again and the form will not be reset. At least that’s what testing showed me :smile:

But you are right this should have been posted in the same thread to avoid duplication.

@megazoid

Solution you have given is very cool
but that was working when document is ready I tried suggestion
given by @RyanReese
"Perhaps on page load you can manually set the elements to ‘’ in jQuery
so "

from that i got my solution

ya they are related to each other.
my mistake asking similar type question again

Thanks for pointing me

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.