I used HTML and JavaScript to allow a user to enter text and then push submit. When the user pushes submit, his text is displayed on the page. The problem is that when the page is reloaded, the text goes away. Obviously. Here is the code I have:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<p id="printhere"></p>
<TEXTAREA Name="content" ROWS="5" COLS="20" id = "userInput"></TEXTAREA>
<button onclick="display()">post</button>
<script>function display(){
var post = document.getElementById("userInput").value;
document.getElementById("printhere").innerHTML = post;
}</script>
</body>
</html>
Is there anyway to make input stay once the page reloads?
1 Answer(s)