Actually, I am trying to get a single table column value after search. If I select = operator and type column any input value and then after a search, the input value will get like one or more row that matches the similar value. In the same way, if I select < operator and this column any input value the less than input value will get if I select > operator and this column any input value the greater than input value will get if I select <= operator and this column any input value the less than or equal input value will get if I select >= operator and this column input value the greater than or equal input value will get. But I can't do this column search. How can I solve this search problem?
$('button').click(function(){
var avlQuantity = new Array();
var aggOperator = $('#aggregate_condition').val();
var inputValue = $('#available_quantity').val();
console.log(aggOperator,inputValue,idValue)
$('table tbody tr').each(function(){
avlQuantity.push($(this).find('td').text());
console.log($(this).find('td').text());
});
if(aggOperator,inputValue){
avlQuantity.push($(this).find('td').text());
// console.log(avlQuantity.push($(this).find('td').text()));
console.log(aggOperator,inputValue)
}
var counter = 0;
$('table tbody tr').each(function(){
counter++
var rowId = $(this);
rowId.addClass("rowId_"+counter);
$(this).find("rowId"+counter).text();
console.log("rowId_"+counter);
avlQuantity.forEach(function(rowId){
if(rowId == "rowId_"+counter){
$("rowId_"+counter).show();
}
})
})
console.log('end');
})
table {
width: 100%;
}
table thead th {
padding: 15px;
}
table tbody tr td{
padding: 10px;
text-align: center;
}
.text-center{
text-align: center;
}
.header-name{
display: flex;
justify-content: center;
align-items: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<table>
<thead>
<th class="text-center">
Regular Price
<div class="header-name">
<div>
<select id="aggregate_condition">
<option value="=">=</option>
<option value="<"><</option>
<option value=">">></option>
<option value="<=">≤</option>
<option value=">=">≥</option>
</select>
</div>
<div>
<input type="text" id="available_quantity">
</div>
<div>
<button type="submit">Apply</button>
</div>
</div>
</th>
</thead>
<tbody>
<tr>
<td>4</td>
</tr>
<tr>
<td>9</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>0</td>
</tr>
<tr>
<td>6</td>
</tr>
<tr>
<td>1</td>
</tr>
<tr>
<td>6</td>
</tr>
</tbody>
</table>