title: Passing Javascript DOM Value to Inner HTML
body: <p>i need to get some value from one hidden id and pass it to another ID as inner HTML.</p>
  
  <p>here my code</p>
  
  <pre><code>&lt;script&gt;
  function replaceText(){
  var x=document.getElementById("mainTitle1").value;
  document.getElementById("mainTitle").innerHTML=x;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here HTML File</p>
  
  <pre><code>&lt;span id="mainTitle"&gt;&lt;/span&gt;
  
  &lt;span style="display:none;" id="mainTitle1"&gt;Text Content&lt;/span&gt;
  </code></pre>
  
  <p>but this isn't working. I'm getting 'undefined'</p>