Hamza Shah

Hamza Shah

  • NA
  • 87
  • 22.9k

Show spinner loader on submit button in form with click

May 26 2021 8:33 PM
I'm trying to show spinner loader when I click on submit button but submit button is not working. spinner loader appears for some time but submit button not hitting to the controller method. And if you have any better login on this please guide me.
 
Here's my button code
  1. <button id="send-button" class="btn btn-primary form-side__btn" type="submit" >Send  
  2. <div id="button-spinner" style="margin-left: 10px; width: 15px; height: 15px; display: none" class="spinner-border"></div>  
  3. </button>  
And Here's my jquery code
  1. $(document).ready(function () {  
  2. $('#send-button').click(function () {  
  3. $('#send-button').attr('disabled'true);  
  4. $('#button-spinner').show();  
  5. setTimeout(function () {  
  6. $('#button-spinner').hide();  
  7. }, 2000);  
  8. });  
  9. });

Answers (5)