I made two HTML files and one the first file (sample.html) . I put a text box and a submit button below that.
When I click submit I want it to go the next HTML file (sample2.html). And the text entered in the textbox in sample.html should appear in a
element in sample2.html.
How do I do this??
<input type="submit" value="Submit" />
The text entered in the textarea input should be present in sample2.html.
How is that done??
I’m a newbie here. I don’t know much better about using HTML. But I would like to learn. Thanks!
Yea, i did all that. I made another JS file and saved the text in localStorage and all that.
But when i clear local storage the text goes. I want the text entered in the textbox of sample.html to be shown in
tag of sample2.html. I used local storage to save the text entered in the textbox but when i clear the local storage it goes away. I tried using variables and all that but not working.
Have any idea how to do this???
Well, yes. You’re deleting the data, I’m not sure what you think will happen there? If you clear the things you need to keep in storage, then they’re gone, you can’t use them.
I know that if i clear local storage the text goes from the local storage in the browser but I dont want it to go away from the HTML tag.
Can you show code you have written for loading text from localStorage to html?
And ofcourse when you clear localStorage the text will go away. HTML will not store any data, so if you remove the source of the storage it will not be visible wherever it is referenced…
The only better way of doing this is by using server side code, or make a single page app using react or plain js.