Element innerHTML Property - Delete the HTML content of a <p> element with id="demo": - Javascript DOM

Javascript examples for DOM:Element innerHTML

Description

Element innerHTML Property - Delete the HTML content of a <p> element with id="demo":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to delete my HTML content.</p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from w  w w. j  a va2 s. co  m*/
    document.getElementById("demo").innerHTML = "";
}
</script>

</body>
</html>

Related Tutorials