Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete rows by id

Status
Not open for further replies.

aigarzzz

Programmer
Apr 5, 2006
16
LV
i have a table:
<table>
<tr id="a1"><td></td></tr>
<tr id="b1"><td></td></tr>
<tr id="a2"><td></td></tr>
<tr id="b2"><td></td></tr>
</table>

how can i delete a1 abd b1 rows by it's id?
 
This will work for any element:

Code:
function deleteObjById(objId) {
   var theObj = document.getElementById(objId);
   if (theObj) theObj.parentNode.removeChild(theObj);
}

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top