Link to home
Start Free TrialLog in
Avatar of johnywhite
johnywhite

asked on

Javascript detect row number of table

Is there any way to detect what row in a table that a user clicked on?  I have a table with regular html buttons (<button id="1"> 2,3,4 ect.) in it.  I have a function that deletes the rows from the table when the user clicks on the button.  But after it deletes the row the row numbers change.  Is there anyway to detect what row the button, or anything for that matter, is in so users can delete more than one row?
ASKER CERTIFIED SOLUTION
Avatar of 0h4crying0utloud
0h4crying0utloud

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 0h4crying0utloud
0h4crying0utloud



Did you need more help with this?
Avatar of johnywhite

ASKER

That doesn't seem to be working it doesn't return anything.  It doesn't give an error either.  Could you post a working page that shows this as an example.
I understand it.  I have to have the row id, however, the deleteRow command only accepts the indexnumber of the row.  Is there anyway to either return the index number or delete a row by it's id?
I just figured it out it is this.parentNode.parentNode.rowIndex instead.  Thanks for your help!

Yeah, that's right, you dont even need the rowID. Glad to Help!

Cheers!
-Vinson Gracia