I am trying to validate phone numbers with intl-tel-input as shown https://intl-tel-input.com/node_modules/intl-tel-input/examples/gen/is-valid-number.html
Here is my code
var telInput = $("#phone"), errorMsg = $("#error-msg"), validMsg = $("#valid-msg");
// initialise plugin
telInput.intlTelInput({
nationalMode: true,
utilsScript: "../../build/js/utils.js"
});
var reset = function() {
telInput.removeClass("error");
errorMsg.addClass("hide");
validMsg.addClass("hide");
};
// on blur: validate
telInput.blur(function() {
reset();
if ($.trim(telInput.val()))
{
if (telInput.intlTelInput("isValidNumber"))
{
validMsg.removeClass("hide");
} else {
telInput.addClass("error");
errorMsg.removeClass("hide");
}
}
});
// on keyup / change flag: reset
telInput.on("keyup change", reset);
But i got stuck on how to validate the phone number when i use the international format like ( +255 123 123 123 ).
I hope the problem is clear enough. Help please
I am attaching the video link where you will learn how to add an international phone number will all validations
https://www.youtube.com/watch?v=cnx2h_Qura8