Allow users to enter their national number, and then convert it to international format using the public method getCleanNumber.
<p id="output">Please enter a number below</p>
<input id="phone" type="tel">
var input = $("#phone"),
output = $("#output");
input.intlTelInput({
nationalMode: true,
utilsScript: "../../lib/libphonenumber/build/utils.js" // just for formatting/placeholders etc
});
// listen to "keyup", but also "change" to update when the user selects a country
input.on("keyup change", function() {
var intlNumber = input.intlTelInput("getNumber");
if (intlNumber) {
output.text("International: " + intlNumber);
} else {
output.text("Please enter a number below");
}
});
Please enter a number below