Delete the HTML content of a <p> element with id="demo":
<!DOCTYPE html> <html> <body> <p id="demo">Click the button to delete my HTML content (innerHTML).</p> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from w ww. j a va 2 s. co m*/ document.getElementById("demo").innerHTML = ""; } </script> </body> </html>