title: Javascript how to update a cart number
body: <p>Hi guys I've decide to try and build an E-commerce site rather then use Shopify just so i can get some experience, however i am trying to get it so that the cart quantity updates when the user clicks "Add to cart" but i cant seem to get it to work  </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;a class="shopping-cart" href="#"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt; &lt;span class="cart-badge"&gt;1&lt;/span&gt;&lt;/a&gt;
  &lt;button class="addcart btn btn-danger add-to-cart" type="button"&gt;Add to cart&lt;/button&gt;
  </code></pre>
  
  <p>Javascript: </p>
  
  <pre><code>   $(document).ready(function(){
         $(".accordion-heading").click(function(){  
               if($(".accordion-body").is(':visible')){  /* check the condition accordion-body is visible or not */
                   $(".accordion-body").slideUp(200);  /*if content is visible then close accordion-body with specific time duration */
                 $(".plusminus").text('+')    /* add plus sign */
             }
             else{
                 $(this).next(".accordion-body").slideDown(200); /*if content not visible then 
                                                                                                             show the accordion-body */
                 $(this).children(".plusminus").text('-');  /* add minus sign */
             }
         });
     });
  </code></pre>
  
  <p>I tried to use this example to help me : <a href="https://codepen.io/jonicious/pen/bCilf?q=add%20to%20cart%20&amp;limit=all&amp;type=type-pens" rel="nofollow noreferrer">Link</a>
  So I just want it so that then the user clicks the "Add to cart" it will update the counter i have built </p>
  
  <p>But javascript isn't my strongest skill set so any help would be amazing , thanks </p>