I have this html code
<div id="div1">
<span>Title</span>
</div>
<table id="table1">
<tr>
<td>AAA</td>
<td>BBB</td>
</tr>
</table>
<div id="div2">
<span>Title</span>
</div>
<table id="table2">
<tr>
<td>AAA</td>
<td>BBB</td>
</tr>
</table>
What I need is, I want to wrap div1 and table1 together.
By using $('#table1, #div1').wrap('<div></div>') It can wrap only one by one.
Is there a way to wrap both together?
You need
.wrapAll().