<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="slider">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="slider">
<div class="item"></div>
</div>
$('.container .element:even').each(function(){
$(this).next().addBack().wrapAll('<div class="row" />')
})