Create a Parent div for multiple child divs - Jquery
jquery
Solution
Assuming you want the result to look like this:
<div class="sExample">
<div>
<div class="child1 one">...</div>
<div class="child2 one">...</div>
</div>
<table>...</table>
<div class="child3">...</div>
</div>
Use `wrapAll()` instead of `wrap()`:
$('.one').wrapAll('<div>');
Problem
My code goes like this, ``` <div class="sExample"> <div class="child1 one">...</div> <div class="child2 one">...</div> <table>...</table> <div class="child3">...</div> </div> ``` I want to include a parent div only for the `.child1` and `.child2` targeting class `.one`. I tried the jQuery `.wrap` method, but its adding parent div for each items. Please help me do this.