title: jQuery click event - button is frozen
body: <p>I have a button on the html page, when user clicks on it part of the html form should be cloned and processed in certain way. Cloning and processing takes some time and I would like to display loader.</p>
  
  <pre><code>  $(".dashed_button.add_supplier").click(function(){
  
          $(".supply-details-tab .inner_tab .supplier_info_link").last().after('&lt;div class="loader"&gt;&lt;/div&gt;');
  
          //Create new tab link
          var newTabLink = $(".inner_tab .supplier_info_link").last().clone();
          $(".inner_tab .supplier_info_link").removeClass("active");
          $(newTabLink).addClass("active");
  
          //Get last existing index
          var lastIndex= parseInt($(newTabLink).attr('id').substring(14));
          var newIndex = lastIndex+1;
          var lastExistingTab = $(".supply-details-tab .tab-pane").last().find("&gt; .subform_fields_wrapper");
  
  
          cloningSupplyDetails($(lastExistingTab), $("#supplier_"+newIndex));
  
          $(".supply-details-tab .inner_tab .loader").remove();
      });
  </code></pre>
  
  <p>The problem is that after click button is frozen, no loader is displayed and the user cannot understand what is happening. After some time new cloned subform is displayed.</p>
  
  <p>How can I stop the button from freezing and display a loader during function execution?</p>