JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test"></div>
JavaScript
$(function(){
var d = $('div.test');
d.data('to-shoot', 1);
alert($('div[data-to-shoot=1]').length);
d.attr('data-to-shoot', 1);
alert($('div[data-to-shoot=1]').length);
var divs = $('div').filter(function(){
return $(this).data('to-shoot') == 1;
});
alert(divs.length);
});