So I have something like
<div>
<!-- other stuff then-->
<button>Hey</button>
</div>
and I’d like to make that (using Javascript/JQuery)
<div>
<!-- other stuff then-->
<div class="bw">
<button>Hey</button>
</div>
</div>
Is that possible? I couldn’t find anything with material on it online…but, I’m a totally JS noob, so I’m probably not using the right terminology. Thanks!
You can use
.wrap()for this:You can test it here, for wrapping multiple elements, use
.wrapAll(), here’s a full list of the wrapping functions.