JSFiddle - React, Tailwind, and code Playground
by Mobeen Sarwar
HTML
<div class="col-sm-6 col-md-3 p0">
<div class="fixed-table-toolbar">
<div class="bars pull-left">
<div id="toolbar">
<select class="form-control input_billing" id="earning1">
<option value="">Earning</option>
<option value="100">100</option> <option value="150">150</option> <option value="250">250</option>
</select>
</div>
</div>
<div class="bars pull-left">
<div id="toolbar">
<select class="form-control input_billing" id="scoring1">
<option value="">Scoring</option>
<option value="70">70</option> <option value="90">90</option>
<option value="100">100</option>
</select>
</div>
</div>
<button id="filter" class="btn btn-success" style="margin-top:8px;" type="button">Filter</button>
</div>
</div>
<table class="table table-condensed" id="mastermindTable">
<thead>
<tr>
<th width="18%" align="left">Name</th>
<th width="26%" align="left">Email </th>
<th width="20%" align="left">Expertise</th>
<th width="16%" align="left">Earning</th>
<th width="16%" align="left">Scoring</th>
<th width="4%" align="left">Status</th>
</tr>
</thead>
<tbody id="mastermindTableBody">
<tr>
<td>Mobeen</td>
<td>[email protected]</td>
<td>PHP</td>
<td>100</td>
...
JavaScript
$("#filter").click(function () {
var tdScoring,tdEarning,hidden_rows=0;
var scoring=$("#scoring1").val();
var earning = $("#earning1").val();
table = document.getElementById("mastermindTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
tdScoring = tr[i].getElementsByTagName("td")[4];
tdEarning = tr[i].getElementsByTagName("td")[3];
if (tdScoring || tdEarning) {
if (tdScoring.innerHTML.indexOf(scoring) == 0 && tdEarning.innerHTML.indexOf(earning) == 0) {
tr[i].style.display = "";
}
else {
tr[i].style.display = "none";
}
}
}
});