jQuery(function ( $ ) { var prices = $('.price').text().match(/\d+/g).sort(function (a, b) { return a - b; }), min = prices[0], max = prices[ prices.length - 1 ]; });