JSFiddle - React, Tailwind, and code Playground

by garreh

HTML

<div></div>

JavaScript

$("div")[0].appendChild(document.createTextNode("a"));
$("div")[0].appendChild(document.createTextNode("b"));

alert($("div").contents().length);
alert($("div").contents().filter(function() {
    return this.nodeType == 3;
}).length);