I am working with a set of elements:
<div id="one">ONE</div>
<div id="two">TWO</div>
<div id="three">THREE</div>
<div id="four">FOUR</div>
<div id="five">FIVE</div>
My goal is to wrap a DIV tag around the elements with IDs "two" and "three" in order to achieve this structure:
<div id="one">ONE</div>
<div class="wrapped">
<div id="two">TWO</div>
<div id="three">THREE</div>
</div>
<div id="four">FOUR</div>
<div id="five">FIVE</div>
Although the "wrapAll" function can only target elements with the same class, like so:
$(document).ready(function(){
$( "div" ).wrapAll( "<div class='wrapped' />");
});
I am hoping for a more elegant solution rather than having to assign the same class to the two DIVs before wrapping them using jQuery.