JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<input type="checkbox" id="cb1" />
<input type="checkbox" id="cb2" />
<input type="checkbox" id="cb3" />
<input type="checkbox" id="cb4" />
</div>
JavaScript
function analyze_checkbox(cb) {
alert(cb.index());
}
$(function(){
analyze_checkbox( $('#cb3') );
});