<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to alert the text of this paragraph.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert(document.getElementById("demo").innerHTML);
}
</script>
</body>
</html>