Question: i have a html table that displays student name and the number of leaves he has taken.how do i filter giving a constraint on the no of leaves and display it
,like if enter 5 in the text box,students with leave of 5 or more should be filtered and displayed.
the code i have now display the records with the entered value

```
    function myFunction1() {
        var input, filter, table, tr, td, i;
        input = document.getElementById("myInput1");
        filter = input.value.toUpperCase();
        table = document.getElementById("myTable");
        tr = table.getElementsByTagName("tr");
        for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[6];
             if (td) {
                 if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                     tr[i].style.display = "";
                 } else {
                      tr[i].style.display = "none";
                 }
              }       
        }
    }

```

Answer: 
A jQuery version

```
var filter = $('#myInput1').val.toUpperCase();

  $("#myTable tr td:eq(6)").each( function() {
       var str = $(this).html().toUpperCase()
       if( str.indexOf(filter) > -1) 
         $(this).parent('tr').css('display','')
       else 
         $(this).parent('tr').css('display','none')
   })

```
Search Textbox:-

```
<label>Search:<input class="form-control input-sm" placeholder="" aria-controls="DataTables_Table_0" type="search" id="txtSearch" onkeyup="filter(this);"></label>

```

Script:-

```
 function filter(element) {
        var value = $(element).val();

        $("#DataTables_Table_1 tr").each(function () {
            if ($(this).text().search(value) > -1) {
                $(this).show();
            }
            else {
                $(this).hide();
            }
        });
    }

```