MichaelMK MichaelMK - 1 year ago 94
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>

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 Source

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