title: Uncaught TypeError: $(...).button is not a function
body: <p>I'm getting <code>Uncaught TypeError: $(...).button is not a function</code> this error when adding product. I debugged it you can see button on root but still getting. Actually this opencart 2.1 function and it is working properly other all pages except one. So can any one please guide me about solution.</p>
  
  <pre><code> &lt;input type="button" class="letTry" value="thisOne"  /&gt;
  
  $('.letTry').on('click',function(){
      cart.add(51,3);
  });
  </code></pre>
  
  <h2>JS Function</h2>
  
  <pre><code>var cart = {
      'add': function(product_id, quantity) {
          $.ajax({
              url: 'index.php?route=checkout/cart/add',
              type: 'post',
              data: 'product_id=' + product_id + '&amp;quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
              dataType: 'json',
              beforeSend: function() {
                  $('#cart &gt; button').button('loading');
              },
              complete: function() {
                  $('#cart &gt; button').button('reset');
              },
              success: function(json) {
                  //alert('TestUpdateTEST');
                  $('.alert, .text-danger').remove();
  
                  if (json['redirect']) {
                      location = json['redirect'];
                  }
  
                  if (json['success']) {
                      //if(personalizePage=='personalize'){
                      //  alert(personalizePage);
                      //}
                      if(is_home=='notHome'){
                              $('#content').parent().before('&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + ' &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;');
                      }
                      if(is_home=='homepage'){
                              $('#homeNoti').before('&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + ' &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;');
                      }
  
  
                      //$('#homeNoti').before('&lt;div id="content"&gt;&lt;div class="container"&gt;&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + ' &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;');
                      // Need to set timeout otherwise it wont update the total
                      setTimeout(function () {
                          $('#cart &gt; button').html('&lt;span id="cart-total"&gt;' + json['total'] + '&lt;/span&gt;');
                      }, 100);
  
  
                      setTimeout(function () {
                          $('.basket').html('&lt;span class="number"&gt;' + json['countItems'] + '&lt;/span&gt;');
                      }, 100);
                      setTimeout(function () {
                          $('.responsive-basket').html('&lt;span class="responsive-number"&gt;' + json['countItems'] + '&lt;/span&gt;');
                      }, 100);
  
                      if(is_home=='notHome'){
                          $('html, body').animate({ scrollTop: 0 }, 'slow');
                      }
                      if(is_home=='homepage'){
                          $('html, body').animate({ scrollTop: 550 }, 'slow');
                      }
                      $('#cart &gt; ul').load('index.php?route=common/cart/info ul li');
                  }
              },
              error: function(xhr, ajaxOptions, thrownError) {
                  alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
              }
          });
      }
  }
  </code></pre>
  
  <h2>Cart HTML</h2>
  
  <pre><code>&lt;div id="cart" class="btn-group btn-block"&gt;
    &lt;button type="button" data-toggle="dropdown" data-loading-text="&lt;?php echo $text_loading; ?&gt;" class="btn btn-inverse btn-block btn-lg dropdown-toggle"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt; &lt;span id="cart-total"&gt;&lt;?php echo $text_items; ?&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;ul class="dropdown-menu pull-right home-page-cart"&gt;
      &lt;?php if ($products || $vouchers) { ?&gt;
      &lt;li&gt;
        &lt;table class="table table-striped"&gt;
          &lt;?php foreach ($products as $product) { ?&gt;
          &lt;tr&gt;
            &lt;td class="text-center"&gt;&lt;?php if ($product['thumb']) { ?&gt;
              &lt;a href="&lt;?php echo $product['href']; ?&gt;"&gt;&lt;img src="&lt;?php echo $product['thumb']; ?&gt;" alt="&lt;?php echo $product['name']; ?&gt;" title="&lt;?php echo $product['name']; ?&gt;" class="img-thumbnail" /&gt;&lt;/a&gt;
              &lt;?php } ?&gt;&lt;/td&gt;
            &lt;td class="text-left"&gt;&lt;a href="&lt;?php echo $product['href']; ?&gt;"&gt;&lt;?php echo $product['name']; ?&gt;&lt;/a&gt;
              &lt;?php if ($product['option']) { ?&gt;
              &lt;?php foreach ($product['option'] as $option) { ?&gt;
              &lt;br /&gt;
              - &lt;small&gt;&lt;?php echo $option['name']; ?&gt; &lt;?php echo $option['value']; ?&gt;&lt;/small&gt;
              &lt;?php } ?&gt;
              &lt;?php } ?&gt;
              &lt;?php if ($product['recurring']) { ?&gt;
              &lt;br /&gt;
              - &lt;small&gt;&lt;?php echo $text_recurring; ?&gt; &lt;?php echo $product['recurring']; ?&gt;&lt;/small&gt;
              &lt;?php } ?&gt;&lt;/td&gt;
            &lt;td class="text-right"&gt;x &lt;?php echo $product['quantity']; ?&gt;&lt;/td&gt;
            &lt;td class="text-right"&gt;&lt;?php echo $product['total']; ?&gt;&lt;/td&gt;
            &lt;td class="text-center"&gt;&lt;button type="button" onclick="cart.remove('&lt;?php echo $product['cart_id']; ?&gt;');" title="&lt;?php echo $button_remove; ?&gt;" class="btn btn-danger btn-xs"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt;&lt;/button&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php } ?&gt;
          &lt;?php foreach ($vouchers as $voucher) { ?&gt;
          &lt;tr&gt;
            &lt;td class="text-center"&gt;&lt;/td&gt;
            &lt;td class="text-left"&gt;&lt;?php echo $voucher['description']; ?&gt;&lt;/td&gt;
            &lt;td class="text-right"&gt;x&amp;nbsp;1&lt;/td&gt;
            &lt;td class="text-right"&gt;&lt;?php echo $voucher['amount']; ?&gt;&lt;/td&gt;
            &lt;td class="text-center text-danger"&gt;&lt;button type="button" onclick="voucher.remove('&lt;?php echo $voucher['key']; ?&gt;');" title="&lt;?php echo $button_remove; ?&gt;" class="btn btn-danger btn-xs"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt;&lt;/button&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php } ?&gt;
        &lt;/table&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;div&gt;
          &lt;table class="table table-bordered"&gt;
            &lt;?php foreach ($totals as $total) { ?&gt;
            &lt;tr&gt;
              &lt;td class="text-right"&gt;&lt;strong&gt;&lt;?php echo $total['title']; ?&gt;&lt;/strong&gt;&lt;/td&gt;
              &lt;td class="text-right"&gt;&lt;?php echo $total['text']; ?&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;?php } ?&gt;
          &lt;/table&gt;
          &lt;p class="text-right"&gt;&lt;a href="&lt;?php echo $cart; ?&gt;"&gt;&lt;strong&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt; &lt;?php echo $text_cart; ?&gt;&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="&lt;?php echo $checkout; ?&gt;"&gt;&lt;strong&gt;&lt;i class="fa fa-share"&gt;&lt;/i&gt; &lt;?php echo $text_checkout; ?&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;?php } else { ?&gt;
      &lt;li&gt;
        &lt;p class="text-center"&gt;&lt;?php echo $text_empty; ?&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;?php } ?&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>