mgets mgets - 8 months ago 42
jQuery Question

Display Table By Price with Jquery

I'm trying to display only the rows that meet the condition, but I seem to be hiding everything with my current solution. Does anyone have an idea of what might be going wrong here, and how to fix it?

var rangeOne = "col2.alpha";

if ($(rangeOne < 500)) {

<script src=""></script>
<button class="priceRangeOne">$0-$499</button>

<tr class="row1 tv">
<td class="col1 alpha">Samsung</td>
<td class="col2 alpha">$499</td>
<tr class="row2 tv">
<td class="col1 alpha">Vizio</td>
<td class="col2 alpha">$500</td>


Try this : You can find all td with class="alpha" and then iterate them to compare amount in it.

var rangeOne = "alpha";
    //find all alpha tds  
       // remove $ sign
       var amount = $(this).html().replace('$','');
       //check if it is amount and compare it
       if(!isNaN(amount) && parseInt(amount) < 500)