
/* 
* this one works...
* as shown on http://www.learningjquery.com/2009/06/shorthand-methods-for-unbind 
*/

(function($) {
  var eventTypes = ['blur','focus','resize','scroll','click','dblclick',
                  'mousedown','mouseup','mousemove','mouseover',
                  'mouseout','mouseenter','mouseleave','change','select',
                  'submit','keydown','keypress','keyup','error'];

  $.each(eventTypes, function(index, eventType) {
    jQuery.fn[ 'un' + eventType ] = function( fn ) {
      return this.unbind( eventType, fn ) ;
    };
  });
})(jQuery);

/*
* this one also works...
* as suggested by Matthew Crumley
*/

/*****
(function($) {
  for (var i=0; i < etLength ; i++) {
    $.fn[ 'un' + eventTypes[i] ] = (function(type) {
      return function(fn) {
        return this.unbind( type, fn );
      };
      })(eventTypes[i]);
    }
})
*****/

/*
* this one does NOT work...
* as *originally* posted on http://www.learningjquery.com/2009/06/shorthand-methods-for-unbind
*/

/*****
(function($) {
  var eventTypes = ['blur','focus','resize','scroll','click',
                 'dblclick','mousedown','mouseup','mousemove','mouseover',
                 'mouseout','mouseenter','mouseleave','change','select',
                 'submit','keydown','keypress','keyup','error'],
  etLength = eventTypes.length;

  for (var i=0; i < etlength ; i++) {
  	$.fn[ 'un' + eventTypes[i] ] = function(fn) {
  		return this.unbind( eventTypes[i], fn );
  	};
  }
})(jQuery);
*****/
