JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="inputcpf" />
<button class="btnchec">verify</button>

JavaScript

function phonenumber(inputtxt) {
    var phoneno = /^(\++(([0-9]{2}))|([0-9]{4}))[-\s\.]?[0-9]{4}[-\s\.]?[0-9]{4}/
    if (inputtxt.match(phoneno)) {
        alert("GOOD");
    } else {
        alert("PLease input correct number");
    }
}

$(".btnchec").click(function () {
    var inputtxt = $("#inputcpf").val();
    console.log(phonenumber(inputtxt));
});