mercredi 1 décembre 2021

Filter out rows using table column with JQuery

I am using this function to filter out rows, its working fine as expected I want to filter rows on specific column.

 $(document).ready(function(){
      $("#aws_table_search").on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $("#resolved_table tr").filter(function() {

              $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
              
        });
      });
    });

Here is the html table code snippet is attached, however I am using a simple input text field as search input "aws_table_search"

<div class="tbl-aws-header">
        <table cellpadding="0" cellspacing="0" border="0">
                                    <thead>
                                        <tr>
                                            <!-- headers -->
                                            <th>Subdomain</th>
                                            <th>Asset Type</th>
                                            <th>IPs</th>
                                            <th>region</th>
                                            <th>Date</th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                    <div style="width: 100%; height: 500px;" class="table-responsive">
                            
                            <div class="tbl-aws-content">
                                <table id="resolved_table" cellpadding="0" cellspacing="0"
                                    border="0">
                                    <tbody id="aws_tbody">
                                    </tbody>
                                </table>
                            </div>
                        </div>



Aucun commentaire:

Enregistrer un commentaire