Strict Mode

As the user types in the input, ignore any irrelevant characters. Basically, the user can only enter numeric characters, and an optional plus at the beginning. Cap the length at the maximum valid number length.

Demo

Markup

<input id="phone" type="tel">

Code

const input = document.querySelector("#phone");
window.intlTelInput(input, {
  initialCountry: "us",
  strictMode: true,
  utilsScript: "/intl-tel-input/js/utils.js?1714308177587" // just for formatting/placeholders etc
});