JSFiddle - React, Tailwind, and code Playground

HTML

<div id="LDOperatingCompanies">
    <input type="checkbox" id="o1" class="test" name="LDOperatingCompanies" value="asdf" /><label for="o1">One</label>
    <input type="checkbox" id="o2" name="LDOperatingCompanies" value="asdf2" /><label for="o2">o2</label>
    <input type="checkbox" id="o3" name="LDOperatingCompanies" value="asdf3"/><label for="o3">o3</label>
</div>
<input type="button" id="btn" value="alert checked boxes"></button>

JavaScript

var checks;
$('#btn').click(function(e) {
    checks = [];
    $(':checked').each(function(index, item) {
        checks.push( item );
    });
    if(checks.length == 0) alert('nothing checked');
   
    var str = '';
    $(checks).each( function( index, item ) {
        str += 'label: ' +test.text+ ', value: ' +item.value + '\r\n';
    });
    alert( str );
});