JSFiddle - React, Tailwind, and code Playground

by John Doe

HTML

<div id="test">
    text 1<br/>
    text 2http://jsfiddle.net/salman/GPsR2/#update
    <div>
        text 3
        <b>text 4</b>
        text 5
    </div>
    text 6<br/>
    text 7
</div>

JavaScript

$(function () {
    var $textNodes = $("#test, #test *").contents().filter(function () {
        return this.nodeType === Node.TEXT_NODE;
    });
    // For testing
    $textNodes.each(function () {
        console.log(this);
    });
});