JSFiddle - React, Tailwind, and code Playground

by Jonathan Sampson

HTML

<ul>
    <li><a class="close">x</a>text</li>
    <li><a class="close">x</a>more text</li>
    <li><a class="close">x</a>wohoooo more text</li>
</ul>

JavaScript

$.extend( $.fn, {
    textnodes: function() {
        return $(this).contents().filter(function(){
            return this.nodeType === 3;
        });
    }
});

var nodes = $("ul li").textnodes();

console.log( nodes );