title: How to get an H1 text inside a div through an omouseover event and innerHTML property
body: <p>I'm trying to write the content of my H1 inside a div when I put the mouse over the H1, but only get [Object HTMLHeadingElement], not the text itself. I'm a total beginner and I'm trying it with the innerHTML property. Thank you all!</p>
  
  <pre><code>HTML code:
  
  &lt;h1 id="phrase" onmouseover="writeInDiv2()"&gt;Hi all&lt;/h1&gt;
  
  JavaScript code:
  
  var text = document.getElementById("phrase");
  
  function writeInDiv2(){
      if(div2.style.display != "none"){
          div2.innerHTML = text;
      }
  }
  </code></pre>