jQuery remove elements
By jQuery, you can easily delete the existing HTML elements.
Removing elements / Content
To delete elements and content, generally use the following two jQuery methods:
- remove () - delete the selected element (and its children)
- empty () - delete the child element selected from the elements
jQuery remove () method
jQuery remove () method removes the selected element and its children.
jQuery empty () method
jQuery empty () method to delete the selected element child elements.
Filter element is removed
jQuery remove () method also accepts a parameter that allows you to filter element to be deleted.
This parameter can be any jQuery selector syntax.
The following examples delete class = "italic" all <p> elements: