diff --git a/src/jquip.js b/src/jquip.js index f261002..8a694fb 100644 --- a/src/jquip.js +++ b/src/jquip.js @@ -434,6 +434,13 @@ window['$'] = window['jquip'] = (function(){ p['clone'] = function() { return $(this.map(function() { return this.cloneNode(true); })); }; + p['toggleClass'] = function(className, val) { + return this['each'](function() { + var el = $(this); + (typeof val === 'undefined' ? !el.hasClass(className) : val) + ? el.addClass(className) : el.removeClass(className); + }); + }; $['Expr'] = { 'hidden': function(el){ diff --git a/test/runner.html b/test/runner.html index fa6b8d4..a6ca603 100644 --- a/test/runner.html +++ b/test/runner.html @@ -14,6 +14,7 @@ +