How to remove next row tr from table in jquery

/ / 0 Comments

jQuery remove tr: This article explains how to delete tables next row .i.e how to remove or delete next row / tr from a table on a button click in jquery. For selecting next element we use .next() jQuery method, so we can able to delete next row from selected element.  jQuery .next() method get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.

Code: code to delete next tr

 $("#tbUser").on('click', '.btnDelete', function () {
    $(this).closest('tr').next().remove();
}); 
VIEW DEMO

Thank you for reading, pls keep visiting this blog and share this in your network. Also, I would love to hear your opinions down in the comments.

PS: If you found this content valuable and want to thank me? 👳 Buy Me a Coffee

Subscribe to our newsletter

Get the latest and greatest from Codepedia delivered straight to your inbox.


Post Comment

Your email address will not be published. Required fields are marked *

0 Comments