Hi Alex, this is easy with JQuery's filter method because these days it can
take a custom function to decide how to filter your elements:

Try something like this... (I'd also recommend a simple check to ensure
value is numeric before comparing it)

// To hide all "searchResult" DIVs containing resultPrice > 7:

$("DIV.searchResult").filter(function(){

        return $("DIV.resultPrice",this).val() > 7

}).hide()

Cheers,
George


Alex Ezell-2 wrote:
> 
> I am working a page which will filter search results based on user
> input via checkboxes or sliders. The question I have is what is the
> best way to identify and remove elements based on a value. Take this
> HTML structure as an example (produced via PHP).
> 
> <div id="searchResult_16" class="searchResult">
>   <div class="resultTitle">Turkey</div>
>   <div class="resultPrice">6.95</div>
> </div>
> 
> <div id="searchResult_17" class="searchResult">
>   <div class="resultTitle">Roast Beef</div>
>   <div class="resultPrice">7.95</div>
> </div>
> 
> Then the user uses a slider to send the maximum price as 7.00. How
> would I, using jQuery obviously, find the elements whose resultPrice
> is higher than 7.00 and remove it from display, not totally remove it
> from the DOM, just hide it?
> 
> Essentially, I am looking at a client side filter, but I just am not
> sure how to approach it.
> 
> /alex
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Find-and-Remove-Elements-tf3441142.html#a9601469
Sent from the JQuery mailing list archive at Nabble.com.


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

Reply via email to