Thanks to the list, I was introduced to filter() and the awesome combo
of CSS and XPath selectors.

Right now, this is the code I have for filtering. It is triggered by
an onChange event from Interface's slider(). I also have links that
can trigger it, so there's that.

Here's the script:
function filterResults(field,value) {
    $('.resultPost:visible').filter(function(index) {
        return ($(field, this).text() > value);
    }).DropOutUp(500);
    $('.resultPost:hidden').filter(function(index) {
        return ($(field, this).text() < value);
    }).DropInUp(500);
}

This is what I started with:
$(".searchResult").show().filter(function(index) {
    return ($(".resultPrice", this).text() > filterPrice);
}).hide();

but the chaining caused some issues when I wanted to animate the
hiding and showing. It looked like my search results were dancing.

So, my question is. How can I clean up the top function I've ended up
with? It works, but I just know there might be a cleaner way.

/alex

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to