title: How can I use the filter function in jquery to filter a group of data inside a div?
body: <p>I'm having cards and inside of them are data from a database. These cards are enclosed in a div called <strong>search</strong>. I'm trying to filter the cards with the data inside them and output the cards with the same data used to filter. For example each card has different names and I want the card having the same address, I want those cards to be displayed per <strong>keypress</strong>. This is the code I currently have</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function(){
          $("#myInput").on("keyup", function() {
              var value = $(this).val().toLowerCase();
              $("#search card").filter(function() {
                  $(this).toggle($(this).text().toLowerCase().indexOf(value) &gt; -1)
              });
          });
      });
  &lt;/script&gt;
  
  &lt;div id = "search"&gt;
  
  
          &lt;?php foreach($query as $row):  ?&gt;
  
              &lt;div class="card-deck" &gt;
                   &lt;div class="col-xs-6 col-sm-6 col-lg-4"&gt;
                      &lt;div class="card"&gt;&lt;center&gt;
                          &lt;a href="testingsite.dev/tenant/&lt;?php echo $row-&gt;userID; ?&gt;" class="btn btn-default"&gt;&lt;img src = "https://admin.orangesuites.ph/static/uploads/&lt;?php echo $row-&gt;profile_pic; ?&gt;" width="209" height="180" &gt;&lt;/a&gt;
                              &lt;div class="card-body"&gt;
                                  &lt;h3 class="card-title"&gt;&lt;?php echo $row-&gt;firstName . ' ' . $row-&gt;lastName; ?&gt;&lt;/h3&gt;
                                  &lt;p class="card-text"&gt;Room Number: &lt;?php echo $row-&gt;bldg_num . '-' . $row-&gt;room_num; ?&gt;&lt;br&gt;
                                      Price: &lt;?php echo $row-&gt;price; ?&gt;&lt;br&gt;
                                      Move In Date: &lt;?php
                                      $move_in = new DateTime($row-&gt;move_in_date);
                                      echo $move_in-&gt;format('F j, Y');
                                      ?&gt;&lt;br&gt;
                                       Move Out Date: &lt;?php
                                      $move_out = new DateTime($row-&gt;move_out_date);
                                      echo $move_out-&gt;format('F j, Y');
                                      ?&gt;&lt;br&gt;
                                      Pending Amount: &lt;?php echo $pending_total[$row-&gt;merge_id]; ?&gt;&lt;br&gt;
                                      Contact Number: &lt;?php echo $row-&gt;phone; ?&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
                                  &lt;/p&gt;
                              &lt;/div&gt;
                              &lt;div class="card-footer"&gt;
  
                               &lt;/div&gt;
                          &lt;/center&gt;&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;?php endforeach; ?&gt;
  
  &lt;/div&gt;
  </code></pre>