title: Copying from a Div into an input box on button click
body: <p>I have created a counter with of course stop and start button. I want to make a simple time start time out and without the use of much jquery I thought of way to save it using php only with very minimal use of jquery.</p>
  
  <p>On stop button click I want the div number to be copied and saved into an input textbox. Here's my code, kindly advise where I went wrong. Coz whenever I click stop it says in input textbox undefined</p>
  
  <p><strong>Here's the HTML</strong></p>
  
  <pre><code>&lt;div class='buttons'&gt;
      &lt;button class='btn btn-default'  onclick='startTimer()' id='button1'&gt;Start&lt;/button&gt;
      &lt;button class='btn btn-default'  onclick='stopTimer()' id='button2'&gt;Stop&lt;/button&gt;
      &lt;div&gt;
          &lt;form role='form' action='create_delete_edit.php' method='POST'&gt;
              &lt;div class='dataTable_wrapper timer' id='timer' style='font-size:50pt;'&gt;00:00&lt;/div&gt;&lt;/br&gt;
              &lt;input type='text' id='timerhide' name='timerhide'&gt;
              &lt;input type='submit' class='btn btn-default' value='Save Duration' id='btnsaveduration' name='btnsaveduration'&gt;
              &lt;input type='submit' class='btn btn-default' value='Close Timer' id='btnclosetimer' name='btnclosetimer'&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p><strong>Now here's the function o the stop</strong></p>
  
  <pre><code>function stopTimer()
  {
     w.terminate();
     timerStart = true;
     w = null;
     var n1 = document.getElementById('timer').innerHTML;
     var n2 = document.getElementById('timerhide');
     n2.value = n1.value;
  
  }
  </code></pre>
  
  <p>How will I place the value of N1 to N2 without encountering such error?</p>
  
  <p>Thanks in advance.</p>