title: Get the index of columns of table if the column text found in different tags
body: <p>How can we find the index of columns satisfying below tables ?  Some text are in <code>&lt;th&gt;</code> directly, some are in <code>&lt;a&gt;</code> tag and some are in <code>&lt;div&gt;</code></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>      &lt;thead&gt;
         &lt;tr&gt;
            &lt;th&gt;Text 1&lt;/th&gt;
            &lt;th&gt;Text 2&lt;/th&gt;
            &lt;th&gt;Text 3&lt;/th&gt;
          &lt;/tr&gt;
          
      &lt;/thead&gt;    
  //Another table:
      &lt;thead&gt;
         &lt;tr&gt;
             &lt;th&gt;
              &lt;a&gt;Text 1&lt;/a&gt;
              &lt;/th&gt;
              &lt;th&gt;
              &lt;a&gt;Text 2&lt;/a&gt;
              &lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
  
   //Another table:       
      &lt;thead&gt;
         &lt;tr&gt;
             &lt;th&gt;
              &lt;div&gt;Text 1&lt;/div&gt;
              &lt;/th&gt;
              &lt;th&gt;
              &lt;div&gt;Text 2&lt;/div&gt;
              &lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I have tried below, but this is not complete yet,  how can we handle all in single line of code ?</p>
  <pre><code>let columnName = &quot;Text 1&quot; ;
  const rowText1 = $('#tableID').find('thead').find(`tr:has(a:contains(${columnName}))`).index();
  const rowText2 = $('#tableID').find('thead').find(`tr:has(th:contains(${columnName}))`).index();
  </code></pre>
  <p><a href="https://i.stack.imgur.com/yNcjW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yNcjW.png" alt="enter image description here" /></a></p>