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 Chriss Miller 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
Joined
Apr 5, 2006
Messages
16
Location
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]
 
yes, that works!! Thank You:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top