Here is the html table
<table> <tr> <td>nonono</td> <!-- FIND THIS --> <td>foobar</td> </tr> <tr> <td>nonono2</td> <!-- FIND THIS --> <td>foobar2</td> </tr> <tr> <td>nonono3</td> <!-- FIND THIS --> <td>foobar2</td> </tr> </table>
Jquery script:
$(function() { var val = $('tr td:first-child').text(); console.log(val); });
Try this —
<code><span class="pln">$</span><span class="pun">(</span><span class="str">"tr"</span><span class="pun">).</span><span class="pln">find</span><span class="pun">(</span><span class="str">"td:first"</span><span class="pun">)</span></code>
Or
<code><span class="pln">$</span><span class="pun">(</span><span class="str">"tr td:first-child"</span><span class="pun">)</span></code>.text();
Demo -> <a href=”https://jsfiddle.net/jitsubha/3rmm4c8y/”>JSFiddle demo</a>
Question and answer is powered by AnsPress.io