Why does it show blank white after button work
Here is my code, please run the code amd see the problem. After i click the button it shows what i want but after that it goes to blank page <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <div class="box" id= "topbar"> <h1 id="main-name">SOCIAL MEDIA</h1> </div> <div class="box" id= "body"> <form> <input type= "text" id= "post"> <button onclick="submit()">submit</button> </form> <li style= "color:white;">hello</li> </div> <script type=text/javascript> function submit() { var posttext= document.getElementById("post").value; alert(posttext) } </script> </body> </html>