Solved : Identifying the TD That Specific Text Resides In
I am attempting to create a link (actually just a span) inside a table cell that will cause the entire row to be deleted. I've come across many examples where I can effect this by identifying the rowIndex of a particular TD when it is clicked on and then use deleteRow to delete the row.
The problem with this is that the TD itself requires the onClick event such as :
<td onclick="alert(this.parentNode.rowIndex);">Click to see the rowIndex</td>
When anything within the TD is clicked, an alert will popup saying what the rowIndex is of the particular TR the TD resides in.
My problem is that I want to be able to do this ONLY when the text inside my span inside the TD is clicked. I can't make it work.
Here is an example :
<td>This is the <span onClick="alert(?????)";>text</span> I want users to click.</td>
What can I do to that span's onClick property to reference the TD then reference the TR so that I can get the rowIndex?