JSFiddle - React, Tailwind, and code Playground
HTML
<a href="test" class="test">Hello</a>
<br />
<a href="test" class="test">Hello</a>
JavaScript
$.fn.test = function(str) {
this.each(function() {
$(this).data('test', true);
alert(str);
});
};
$.fn.pluginApplied = function(pluginName) {
var count = 0;
this.each(function() {
if($(this).data(pluginName)) {
count++;
}
});
return count;
};
$("a").test('test');
alert($("*").pluginApplied('test'));