Add/remove class from button
<p>I am using this <a href="https://github.com/geedmo/portfilter/blob/master/bootstrap-portfilter.js" rel="nofollow">Very Lightweight Portfolio Filter for Bootstrap</a> and I want to add or remove class from the buttons being clicked.</p>

<p>So by default I want to set the All button with the class <code>btn-primary</code> and then when the user clicks on another button remove <code>btn-primary</code> from the All button and add the class <code>btn-default</code> to the All button and <code>btn-primary</code> to the button that was clicked.</p>

<p>I just can't figure out how to add this to the jquery library i'm using. Can someone help me with an example of what I should do?</p>

<p>Here is some code:</p>

<pre><code>!function ($) {

  "use strict"; // jshint ;_;

  var pluginName = 'portfilter';

 /* PUBLIC CLASS DEFINITION
  * ============================== */

  var PortFilter = function (element) {

    this.$element = $(element);
    this.stuff    = $('[data-tag]');
    this.target   = this.$element.data('target') || '';

  };

  PortFilter.prototype.filter = function (params) {
    var items = [],
        target = this.target;
    this.stuff
        .fadeOut('slow').promise().done(function(){
            $(this).each(function(){
                if($(this).data('tag') == target || target == 'all') 
                    items.push(this);                    
            });
            $(items).show();                  
        });  
  };


 /* PLUGIN DEFINITION
  * ======================== */

  var old = $.fn[pluginName];

  $.fn[pluginName] = function (option) {
    return this.each(function () {
      var $this = $(this)
        , data = $this.data(pluginName);

      if(!data) $this.data(pluginName, (data = new PortFilter(this)));

      if (option == 'filter') data.filter();
    });
  };

  // DEFAULTS
  $.fn[pluginName].defaults = {};

  // CONSTRUCTOR CONVENTION 
  $.fn[pluginName].Constructor = PortFilter;


 /* PORTFILTER NO CONFLICT
  * ================== */

  $.fn[pluginName].noConflict = function () {
    $.fn[pluginName] = old;
    return this;
  };

 /* PORTFILTER DATA-API
  * =============== */

  $(document).on('click.portfilter.data-api', '[data-toggle^=portfilter]', function (e) {
        $(this).portfilter('filter');
        $("button").not(target).removeClass("btn-primary");
        $(target).addClass("btn-primary");
  });

}(window.jQuery);
</code></pre>

<p>This is what I added to the code above:</p>

<pre><code>$("button").not(target).removeClass("btn-primary");
$(target).addClass("btn-primary");
</code></pre>

<p>I have tried a few other things and will be glad to share if needed.</p>