Removing Element Contents in jQuery
The empty method can be used to remove the contents of elements (the elements themselves will not go anywhere). For example, there are the following paragraphs:
<p>text</p>
<p>text</p>
<p>text</p>
Let's delete their contents:
$('p').empty();
HTML the code will look like this:
<p></p>
<p></p>
<p></p>
Make all h2 empty.