Hello everyone, I can't get the content out of the html table cell

<table> <tr> <th style="border-bottom: 1px solid #FBFBFB;" class="shop_id">№</th> <th style="border-left: 1px solid #FBFBFB;" class="shop_address">Адрес</th> <th style="border-left: 1px solid #FBFBFB;" class="shop_phone">Телефон</th> </tr> <?php $shop_query = mysqli_query($link, 'SELECT * FROM `shopping_opportunities`;'); while ($shop = mysqli_fetch_assoc($shop_query)) { echo '<tr class="srt_table_shop">'; echo '<td class="shop_id">'.$shop[id].'</td>'; echo '<td class="shop_address">'.$shop[address].'</td>'; echo '<td class="shop_phone">'.$shop[phone].'</td>'; echo '</tr>'; } ?> </table> 

now, using jquery, I pull out all the rows of the table, then loop through the array formed from the rows of the table, but I can’t get the value out of the cell of this row, what should I do?

 $('#shop_search').keypress(function(){ var str_search = $(this).val(); var tr = $('.srt_table_shop'); $.each(tr, function(){ var tr_array = this.children; console.log(tr_array[1]); }); }); 

enter image description here

  • If I understand correctly, you need to get the text, and get the text with tags? - nicolaa
  • Everything, I did already - Konstantin Stramaus

1 answer 1

jQuery can search by content:

 $('td:contains("НАЗВАНИЕ КОМПАНИИ")'); 

To get the value you can write like this:

 $('table').find('.shop_address').first().text();