Select td which contains a (Anchor) tag using jquery
html, jquery
Solution
Description
Many ways to do this
You can use the parent css selector or jQuery's `parent()` function. Check out the sample and this jsFiddle Demonstration
Sample
- `$("td > a").parent()`
- `$("td > a:parent")`
More Information
- jQuery - :parent Selector
- jQuery - parent()
Problem
I have an HTML code as given below. I want to select all td which contains `a`(anchor) as an immediate child (Here First TD tag) using jQuery. ``` <table> <tr> <td><a href="abc.aspx">ABC</a></td> <td>Second Level<span> >> </span> <div> <table> <tr> <td><a href="efg.aspx">EFG</a></td> </tr> </table> </div> </td> </tr> ```