title: Start and stop simple clock on button push
body: <p>I have a simple webpage:</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      When button has value of "Start Clock" and button is pushed:
        &lt;li&gt;The clock information is shown in the textfield&lt;/li&gt;
        &lt;li&gt;The value of the button changes to "Stop Clock"&lt;/li&gt;
      When the button has the value "Stop Clock" and button is pushed
        &lt;li&gt;The clock information stops in the textfied&lt;/li&gt;
        &lt;li&gt;The button value changes to "Start Clock"&lt;/li&gt;
  
      &lt;input type="text" id="clocktext"/&gt;
      &lt;input type="button" id="clockb" value="Start Clock"/&gt; 
  
      &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="scripts.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I also have a script file:</p>
  
  <pre><code>function myclock() { 
      var date = new Date(); // Get the current date/time
      var hour = date.getHours(); // Save hours
      var min = date.getMinutes(); // Save minutes
      var sec = date.getSeconds(); // Save seconds
      formathour = format(hour); // Format hours
      formatmin = format(min); // Format minutes
      formatsec = format(sec); // Format seconds
      timeout = setTimeout("myclock()", 1000); 
  }
  
  function format(x) {
      if (x &lt; 10) x = "0" + x;
      return x;
  }
  
  $("#clockb").click(function () {
      var c = setInterval(setTheTime(), 1000);
      if (this.value == "Start Clock") {
          $(this).prop('value', 'Stop Clock'); // Set button value to Stop Clock
      } else if (this.value == "Stop Clock") {
          $(this).prop('value', 'Start Clock');
              clearInterval(c);
      }
  });
  
  function setTheTime() {
      myclock();
      var curTime = formathour+":"+formatmin+":"+formatsec // Current time formatted
      $("#clocktext").prop('value', curTime);
  }
  </code></pre>
  
  <p>I cannot get the clock to continually update when the button is pushed :/</p>
  
  <p>I feel like I'm over complicating this and its very annoying.</p>
  
  <p>Any insight would be helpful as I am very new to jQuery and js</p>