How to create a parent tag inside an element with jQuery, for example, having this original structure:
<p>texto</p>
After the jQuery function would look like this:
<a href='#'>
<p>texto</p>
</a>
How to create a parent tag inside an element with jQuery, for example, having this original structure:
<p>texto</p>
After the jQuery function would look like this:
<a href='#'>
<p>texto</p>
</a>
You can do this:
$('p').wrapAll('<a href="#" />');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>texto</p>