$.fn.equalize = function() { var maxHeight = 0; return this.each(function(){ var $this = $(this); if ($this.height() > maxHeight) { maxHeight = $this.height(); } $this.height(maxHeight); }); };