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