JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" class="abc">

JavaScript

$(document).ready(function() {
    $('.abc').bind('keyup', function() {
        regex = /^[A-z0-9]+$/;
        if(!regex.test($(this).val())) {
            $(this).next('.error').remove();
            $(this).after('<div class="error">Wrong</div>');
        } else {
           $(this).next('.error').remove();            
        }
    }); 
});