JSFiddle - React, Tailwind, and code Playground
HTML
<div id="one">ONE</div>
<div>TWO</div>
<div>THREE</div>
<div id="four">FOUR</div>
<div id="five">FIVE</div>
CSS
.wrapped {
background: red;
}
JavaScript
arr= $('div');
$(arr[1]).attr('id','two');
$(arr[2]).attr('id','three');
$('#two, #three').wrapAll( "<div class='wrapped' />");;