JSFiddle - React, Tailwind, and code Playground

by oroce

HTML

<input type="text" id="test1" />

JavaScript

(function($) {
    $.fn.capFirst = function() {
        console.log(arguments, this);
        $(this).bind("keyup", function(e) {
            console.log(e);
            if (e.keyCode > 64 ) {
                this.value = (this.value || "").replace(/^(.)/, function(m) {
                    return (m || "").toUpperCase();
                }).replace(/ (.)/, function(m) {
                    return ((m || "").toUpperCase());
                });
            }
        });
    };
})(jQuery);
$(document).ready(function() {
    $("#test1").capFirst();
});