title: Jquery: How to add spinner to input type button
body: <p>see this <a href="http://www.jqueryscript.net/demo/jQuery-Plugin-For-Built-In-Loading-Indicator-In-Buttons-Button-Loader/" rel="nofollow">URL</a> for the jquery plugin of the loading indicator</p>
  
  <h2>see the code</h2>
  
  <pre><code>(function ($) {
      $.fn.buttonLoader = function (action) {
          var self = $(this);
  
          //start loading animation
          if (action == 'start') {
              if ($(self).attr("disabled") == "disabled") {
                  e.preventDefault();
              }
              //disable buttons when loading state
              $('.has-spinner').attr("disabled", "disabled");
              $(self).attr('data-btn-text', $(self).text());
              //binding spinner element to button and changing button text
              $(self).html('&lt;span class="spinner"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/span&gt;Loading');
              $(self).addClass('active');
          }
          //stop loading animation
          if (action == 'stop') {
              $(self).html($(self).attr('data-btn-text'));
              $(self).removeClass('active');
              //enable buttons after finish loading
              $('.has-spinner').removeAttr("disabled");
          }
      }
  })(jQuery);
  </code></pre>
  
  <p>the above code work fine with html button tag <code>&lt;button class="btn btn-default has-spinner" id="btnTest" runat="server"&gt;Test IT&lt;/button&gt;</code></p>
  
  <h2>call the code like this way</h2>
  
  <pre><code>var btn = $("#btnTest");
  $(btn).buttonLoader('start'); 
  </code></pre>
  
  <p>and stop like <code>$(btn).buttonLoader('stop');</code></p>
  
  <p>but the problem is if i am using html submit button then whole code does not work. So what change i need to add as a result it should work for <strong>html button and submit button too</strong>.</p>