there's a site with lots of comments.
code1
<p>hello ernie</p>
<p>this is mark</p>
<p>hello ben</p>
<p>this is ernie</p>
<p>hello mark</p>
<p>this is ben</p>
Now I want to collect all comments containing 'hello' and insert the phrases with hello after all comments.
$("p:contains('hello')").insertAfter($("#comments"));
'hello' is taken from the comments and inserted after the comments.
code2
<p>this is mark</p>
<p>this is ernie</p>
<p>this is ben</p>
code3
<p>hello ernie</p>
<p>hello ben</p>
<p>hello mark</p>
Is there a way to keep the comments as they were (code1) and still insert all comments containing 'hello' after the comments. Like
How it should look like.
<p>hello ernie</p>
<p>this is mark</p>
<p>hello ben</p>
<p>this is ernie</p>
<p>hello mark</p>
<p>this is ben</p>
<p>hello ernie</p>
<p>hello ben</p>
<p>hello mark</p>
Any hint or help is much appreciated.