SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    0 Post(s)
    0 Thread(s)

    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?

    Any suggestions??
    Last edited by justbn_me; Sep 12, 2006 at 05:44. Reason: Solved


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts