JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
(function($) {
$.fn.numeric = function(options) {
return this.each(function () {
var $this = $(this);
$this.blur(function(e) {
if (isNaN(+this.value)) {
$('<span class="error">Must be numeric</span>').insertAfter($this);
} else {
$this.next('span.error').remove();
}
});
});
};
}(jQuery));
$('input').numeric();