remove() : removes the selected element(s) and its child elements.
Example
$("#div1").remove();
empty() : removes the child elements of the selected element(s).
Example
$("#div1").empty();
Filtering elements to be removed
remove() method also accepts one parameter, which allows you to filter the elements to be removed.
This parameter can be any of the jQuery selector syntaxes.
Example : Removes all <p> elements with class="myclass"
$("p").remove(".myclass");
No comments:
Post a Comment
Note: only a member of this blog may post a comment.