JSFiddle - React, Tailwind, and code Playground

HTML

<form name="form">
    <input type="text" name="scanid" onkeyup="tel(this);"/>
</form>

JavaScript

function tel(formElement)
{
    if(formElement.value.length == 21) {
        formElement.form.submit();
    }
}