Jquery .Filter Function Question
Posted
by Matias
on Stack Overflow
See other posts from Stack Overflow
or by Matias
Published on 2010-04-11T19:08:33Z
Indexed on
2010/04/11
19:13 UTC
Read the original article
Hit count: 271
Hi Guys,
This is kindof a simple question, however, I don´t seem to figure out how to do it:
I´ve got a slider filtering some stuff
$("#price").slider(
{
range: true,
step: 5,
change: function(e,ui) {
$('total').filter(function(index) {
return ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1)));
}).parents('div.item').hide();
}
});
Basically, I want an array with index of each of elements which have been filtered so I can reuse them for other purpose. I was thinking of editing filter function to something like:
$('total').filter(function(index) {
var matches = ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1)));
return matches;
}.myFunction(matches){
//do some stuff here with matched elements
}
This is not correct, your help is greatly appreciated.
© Stack Overflow or respective owner