JSFiddle - React, Tailwind, and code Playground

by lasha

HTML

<ul>
    <input value='omg' />
    <input value='lol' />
    <input value='much better' />
</ul>

JavaScript

var validate = function() {
    if ($(this).val().length == 3) {
        $(this).css('color','red');
    } else {
        $(this).css('color', 'black');   
    }
};

$("input").change(validate);
$("input").each(function(i, e) {
  validate.apply(e);
});