removing a row from a table

i’ve had trouble removing a row from a table using javascript. the tricks i’ve learned assumes that i am dealing with a div always. in some cases, i can’t help but use a table.

a quick google search offered me a lot of solutions. this is the one that worked in my case, and is just 2 lines! for convenience i just placed it in a function.

function removeTableRow(row,tableid)
var r=row.parentNode.parentNode.rowIndex;

so using the function above, you have the following line somewhere:


and somewhere else you have a table that is defined like this:

<table id=’myTable’>
.. .
.. .
.. .


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

Up ↑

%d bloggers like this: