JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
    <li>
        <input type="checkbox" value="username1" name="check[0]"/>
    </li>
    <li>
        <input type="checkbox" value="userusername2" name="check[1]"  />
    </li>
    <li>
        <input type="checkbox" value="userusername3" name="check[2]" />
    </li>
</ul>

JavaScript

var len = $('input:checkbox:checked').length;

alert(len);