I have a bunch of table rows such as:
<tr>
<td>cell1</td>
<td>cell2</td>
<td><a href="action.php">cell3</a></td>
</tr>
When someone clicks the link in cell3 is there a way to hide the whole tr row? So the second they click that link in cell3 the whole tr is hidden?
This is a good place for
.delegate()
, like this:By using
.delegate()
we attach oneclick
handler to the<table>
for all those third-column cells, and then use.closest()
to climb up to the<tr>
to.hide()
. If you want it on the link instead, just changetd:nth-child(3)
totd a
, the rest is the same.hi this is my solution
Yup
Just use simply jQuery and hide the parent.
Remove the a tag. If you want it to have the "link appearance", add a css style for a something clickable:
then: