Captura Innerhtml

by Rapha Souza

HTML

<!DOCTYPE html>
<html>
<body>

<p id="9">Click the button to change the text in this paragraph.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {

var valor = document.getElementById("9").innerHTML;

alert(valor);
  //  document.getElementById("demo").innerHTML = "Hello World";
    
    
    
}
</script>

</body>
</html>