4

I am creating a Sample Registration form using HTML and JS. After filling out all the fields in the form, I have a href link, on clicking it, takes to new HTMl page for uploading documents and on clicking a button in the upload page...it then re-directs to the form page. But the form page gets reloaded and so I am losing all the values given as input.

prakash g
  • 49
  • 1

1 Answers1

2

Here's one way you can do this :

In the JavaScript of the first HTML file (where you get the data):

localStorage.setItem('variable',value)

and then retrieve it from another JavaScript file:

localStorage.getItem('variable')

Another approach:

Global variables in Javascript across multiple files

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
ssomename
  • 505
  • 6
  • 21