Sunday, April 11, 2010

Jquery .Filter Function Question

Programmer Question

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.



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails