Replacing Elements with jQuery's replaceWith Method

You can replace one element with another using the replaceWith method.

Let's look at an example, let's say we have the following paragraphs:

html<p class="www">text</p>
<p class="www">text</p>
<p class="www">text</p>
<p>text</p>

Let's replace all paragraphs with class www with '<div>!!!</div>':

javascript$('.www').replaceWith('<div>!!!</div>');

HTML the code will look like this:

html<div>!!!</div>
<div>!!!</div>
<div>!!!</div>
<p>text</p>
Задание 1

Replace each h2 with its contents.

Задание 2

Replace each h2 with its contents, after wrapping the contents in a paragraph.