tags:

views:

43

answers:

0

Hi Guys,

I've got a Slider with two handles which filters out some divs based on its price.

I need to get an array with the index of the elements which have been matched and filtered to use it on another function. Such as.. var matched = [0, 2, 4, 7]:

$("#price").slider(
     {
range: true,
  step: 5, 
      change: function(e,ui) { 
   $('span.the_total').filter(function(index) {
    return ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1)));
  }).parents('div.item_hotel').show();

}});

Sorry... Question already answered...

change: function(e,ui) { var self = $(this); var indexes = []; $('.total').filter(function(index) { var txt = $(this).text(); if (self.slider("values", 0) <= txt && txt <= self.slider("values", 1)) { indexes.push(index); return true; } }).parents('div.item').hide(); //do something with indexes array }