Aggregate function extension for jQuery