JSFiddle - React, Tailwind, and code Playground

HTML

<input name="crmForm$lastname" type="text" maxlength="50" id="crmForm_lastname" tabindex="2080" class="textBox" onblur="crmForm_lastname_onblur.apply(this, [this]);" style="width: 496px;">

JavaScript

function crmForm_lastname_onblur(sourceField, sourceRowId) {
    var x=document.getElementById("crmForm_lastname");
    x.value=x.value.toLowerCase().replace(/\b[a-z]/g, function(letter) {
        return letter.toUpperCase();
    });
    
    console.log(x.value);
}