In jQuery, the empty()
method is used to remove all the child elements of the selected element in the jQuery collection.
(a).empty()
a
is the element from which we will remove all child elements.In the code below, the content of the span elements are all removed once the Remove button is clicked.