Friday, September 30, 2011

remove(String)

remove(String expr) returns jQuery
Removes all matched elements from the DOM. This does NOT remove them from the jQuery object, allowing you to use the matched elements further.

Can be filtered with an optional expressions.

Example:


$("p").remove();

HTML:
<p>Hello</p> how are <p>you?</p>

Result:
how are

1 comment:

  1. You may remove bottom or last table row

    // Simple bottom row removal
    $('#myTable tr:last').remove();

    // Removing n'th (ex. 3rd) row from the table
    $('#myTable tr:eq(2)').remove();

    ReplyDelete