How can I add code to count character of user input?

export function textBoxshortDescription_keyPress(event) {
    let characterRemaining = $w('#textBoxshortDescription').maxLength - $w('#textBoxshortDescription').value.length;
    
$w('#textCharacterCount').text = `${characterRemaining} Characters Remaining`
}

Note: Set the character limit in Text Box Settings