JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css">
<hr class="begin" />
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<a href="mauris.html">Mauris</a> id diam turpis, et faucibus nunc.
<div><img src="foo.png" /></div>
<hr class="end" />
CSS
.content {
background: yellow;
}
JavaScript
var foundBegin = false;
var foundEnd = false;
$('hr.begin').parent()
.contents()
.filter(function() {
if($(this).is('hr.begin')) {
foundBegin = true;
}
if($(this).is('hr.end')) {
foundEnd = true;
}
return foundBegin && !foundEnd;
})
.wrapAll('<div class="content"/>');