How do I turn this:
<a class="link">
<p class="paragraph">This is some text</p>
<p class="paragraph">This is some more text</p>
<p class="paragraph">And some more</p>
</a>
into this:
<a class="link">
This is some text This is some more text And some more
</a>
with jQuery. I tried using append and merge but I just can’t figure it out.
Since the
textmethod returns the text content of an element and it’s descendants, you can just use that:From the docs:
Here’s a working example.
Update (see comments)
In the case that this needs to apply to multiple
.linkelements, you can useeach: