JSFiddle - React, Tailwind, and code Playground

HTML

<input type='checkbox' alt='bleh' checked='checked' id='1' />
<input type='checkbox' alt='' checked='checked' id='2' />
<span></span>

JavaScript

$('span').text($('input:checkbox:checked[alt!=""]').attr('id'));