Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • I need help making JavaScript remember user input

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 349
    Answer it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: