MichaelMK MichaelMK - 6 months ago 14
jQuery Question

Find text within multiple elements jquery

First, this is probably a duplicate. Just couldn't find any answers that worked for me.

I have a block of elements like this

<a id="folder" href="http://example.com/update.php?dir=%2Fexample%2Fimg">
<i class="fa fa-folder-o"></i>
img
</a>


is there any way for jquery (or just js) to find the text inside there? I'd like it to return 'img' when given that setup.

Thanks in advance, Michael

Answer

It's simply $("#folder").text()