JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="example">

JavaScript

document.getElementById("example").onkeyup = function() {
    if(this.value.length === 10) {
        console.log("ok");  
    } 
};