Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove table row with specific id

Tags:

jquery

I have the following table:

<table id="test">  <tr id=1><td>bla</td></tr>  <tr id=2><td>bla</td></tr>  <tr id=3><td>bla</td></tr>  <tr id=4><td>bla</td></tr> </table> 

Now I want to remove row 3 from the table. How do I do that? Something like:

$("#test tr ??").remove(); 

Thanks!

like image 820
John Avatar asked Dec 23 '10 13:12

John


People also ask

How to remove specific table row in jQuery?

The jQuery remove() method is used to remove a row from HTML table. jQuery remove() Method: This method removes the selected elements alongwith text and child nodes. This method also removes data and events of the selected elements. Parameters: It accepts single parameter selector which is optional.


1 Answers

Try

$('table#test tr#3').remove(); 
like image 76
Dave G Avatar answered Oct 11 '22 12:10

Dave G