jquery move tags

by toubia95

HTML

<div id="main">
  <h1>
  Titre1
  </h1>
  <p>
  Paragraph1
  </p>
  <hr>
   <h1>
  Titre2
  </h1>
  <p>
  Paragraph2
  </p> 
  <p>
  Paragraph3
  </p> 
</div>

JavaScript

$('#main')
  .append($('hr:nth-of-type(1)'))
  .append($('h1:nth-of-type(1)'))
	.append($('p:nth-of-type(1)'))
  .append($('p:nth-of-type(2)'));