I have a div structure like this
<div class="items">
<div class="itemRow">
<div class="item">
<div class="item">
<div class="item">
</div>
<div class="itemRow">
<div class="item">
<div class="item">
<div class="item">
</div>
</div>
How can I make them merge/combine the two divs "itemRow"? to be like this
<div class="items">
<div class="itemRow">
<div class="item">
<div class="item">
<div class="item">
<div class="item">
<div class="item">
<div class="item">
</div>
</div>
using jQuery
Try
var $rows = $('.items .itemRow');
$rows.first().append($rows.not(':first').children())
$rows.not(':first').remove();
Demo: Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With