title: How to change the onclick function value upon clicking a button
body: <p>I've tried looking for answer for this and can't seem find one specific to this.</p>
  
  <p>My site has a button, which looks like this:</p>
  
  <pre><code>&lt;input class="btn btn-success" onclick="w.start()" type="button" value="Start" id='start' /&gt;
  </code></pre>
  
  <p>And on click I want it to change to "Stop" and I want the onclick function to change to <code>onclick="w.stop()"</code> instead of <code>w.start()</code> and I want the class to change to from <code>btn-success</code> to <code>btn-danger</code> (bootstrap)</p>
  
  <p>I <strong>can</strong> get the name to change fine using this jQuery:</p>
  
  <pre><code>$(function () {
      $('#start').click(function () {
          $(this).val() == "Start" ? play_int() : play_pause();
      });
  });
  
  function play_int() {
      $('#start').val("Stop");
      // do start
  }
  
  function play_pause() {
      $('#start').val("Start");
      // do stop
  }
  </code></pre>
  
  <p>But how do I get the onclick function and the class to change? </p>
  
  <p>Especially the onclick function :)</p>