JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
$(document).ready(function() {
$('input').on('keyup', function() {
if (this.value[0] != this.value[0].toUpperCase()) {
// store current positions in variables
var start = this.selectionStart;
var end = this.selectionEnd;
this.value = this.value[0].toUpperCase() + this.value.substring(1);
// restore from variables...
this.setSelectionRange(start, end);
}
});
});