JSFiddle - React, Tailwind, and code Playground
by coltrane
HTML
<li id='list_id'>
<input type="checkbox" name="check"><span> </span>good foo
</li>
JavaScript
var listItem = $('#list_id');
var s = listItem.html();
s = s.substring( 0, s.indexOf('<'));
var matches = s.match(/ /g);
alert(matches.length);