Q:

jQuery find text and extract id from sub element

I am trying to search all my divs for a certain text "www.url.com"
If www.url.com is found i want to extract the table ID from the sub table.
My html is like this:
<div class="box" id="results">
   <div class="box-header">
      <h1>www.url.com</h1>
   </div>
   <table cellpadding="0" cellspacing="0" border="0" class="display" id="24">
      <thead>
         <tr>
            <th>col</th>
         </tr>
         <tr id="161">
            <td class="kw" style="border-left: 1px solid white;border-right: 1px solid #F4F4F4;padding: 12px 14px;position: relative;text-align: left;">111111</td>

         </tr>
      </thead>
      <tbody></tbody>
   </table>

In this case i want to find id="24".
This is what i have so far:
var foundin = $('*:contains("www.url.com")');

Have no idea how to get the id :)

A:

Use:
foundin.find('table').attr('id');

If you want to collect all instances use something like:
foundin.each(function(){
    $(this).find('table').attr('id'); // Gets the ID
    // Store it into something like an array
});

