Q:

jQuery navigating the dom with Each and Nth Child

I'm trying to navigate through each of the tr element and select the 5th td element then store the value in it. What am I doing wrong?
 $("table tbody tr td tbody tr:nth-child(4)").each(function (i) {
    alert(this.text);
  });
<table>
<tbody>
  <tr>
    <td align="center"><table cellpadding="2" style="border: 2px solid rgb(208, 208, 208); border-spacing: 4px; border-collapse: collapse; background-color: rgb(240, 240, 240);">
        <tbody>
          <tr bgcolor="#e0e0e0">
            <th>Seller</th>
            <th>Feedback</th>
            <th>Description</th>
            <th>#</th>
            <th>$</th>
            <th/>
          </tr>
          <tr bgcolor="#e0e0e0">
            <td><a href="http://www.foo.com/">test3</a> </td>
            <td align="right"><a href="http://www.foo.com/User/1857/Feedback.html">+366</a> </td>
            <td>Near Mint English</td>
            <td align="right">8</td>
            <td align="right">12.49</td>
            <td><a href="http://www.foo.com/">Add to Cart</a> </td>
          </tr>
          <tr bgcolor="#f0f0f0">
            <td><a href="http://www.foo.com/">test4</a> </td>
            <td align="right"><a href="http://www.foo.com/User/637/Feedback.html">+1,257</a> </td>
            <td>Near Mint English</td>
            <td align="right">14</td>
            <td align="right">13.58</td>
            <td><a href="http://www.foo.com/">Add to Cart</a> </td>
          </tr>
          <tr bgcolor="#e0e0e0">
            <td><a href="http://www.foo.com/">test5</a> </td>
            <td align="right"><a href="http://www.foo.com/User/2989/Feedback.html">+2,062</a> </td>
            <td>Very Fine English</td>
            <td align="right">2</td>
            <td align="right">13.99</td>
            <td><a href="http://www.foo.com/">Add to Cart</a> </td>
          </tr>
        </tbody>
      </table></td>
  </tr>
</tbody>

Thank you!

A:

The :nth-child is applied to the child selector, not the parent:
$("table tbody tbody td:nth-child(5)").each(function (i) {
        alert(this.text);
});

I also removed un-needed selectors from your selection string.
Correction I just changed :nth-child(4) to :nth-child(5) because the nth-child selector is 1 based not 0 based like an index.

