0

New user of jquery(as in first timer). I have a table that I do a word search on using a jquery search. The search is oriented with a to ignore headers etc. I have zebra striping in the css but when a search is used, it's common to get adjacent rows with the same color. How can I apply the striping after the search result ?

Thanks in advance

my jquery search is:

    <script>
    // THIS SCRIPT DOES THE SEARCH
    $(document).ready(function(){
    $("#myInput").on("keyup", function() {
    var value = $(this).val().toLowerCase();
    $("#myTable tr").filter(function() {
      $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });
   });
   });

    </script>

My css:

    tbody tr:nth-child(even) {    background-color: #eee; }

Ideally, I would like zebra striping before and after the search using colors #FFFFFF and #FFFFCC. I have tried many snippets from various fiddles while looking for a solution. Everything I try ends up breaking the search. I'm likely not putting code in the right place.

rbur
  • 3
  • 2

0 Answers0