JSFiddle - React, Tailwind, and code Playground
by alexdickson
HTML
<li id='list_id'>
<input type="checkbox" name="check"><span> </span>good
</li>
JavaScript
var listItem = $('#list_id');
var clone = listItem.clone();
clone.find('*').remove();
matches = clone.html().match(/ /g);
alert(matches.length);