JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="text" class="no-empty"/>
</form>
JavaScript
(function($){
$.fn.mbValidator = function() {
this.on('submit', function(event) {
$(this).children().each(validate);
event.preventDefault();
});
}
function validate() {
console.log(this);
}
}(jQuery));
$('form').mbValidator();