Country code gets appended in the field after jquery validation error in intl-tel Input

299 Views Asked by At

I'm using the following code to validate country code and contact number :

var e = window.intlTelInput(document.querySelector("#phone"), { separateDialCode: !0, preferredCountries: [currentCountry], hiddenInput: "full", utilsScript: "//cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.3/js/utils.js" });

but the issue is when i validate

jQuery.validator.addMethod(
                "phoneNumValidation",
                function (el, t) {
                   return e.isValidNumber();
                },
                return  "Please Enter Valid Phone Number"
            ),

on error country code is appended existing number.

enter image description here

there are some other fields which are being validated so as soon jquery validator is fired extra country code is being appended.

0

There are 0 best solutions below