Country Code fetch In a Form

Hello!
Need help.
I have a form with a input field: Country Code + Phone number.

var input = document.querySelector(“#phone”),
dialCode = document.querySelector(“.dialCode”),
errorMsg = document.querySelector(“#error-msg”),
validMsg = document.querySelector(“#valid-msg”);

var iti = intlTelInput(input, {
initialCountry: “us”,
placeholderNumberType: ‘FIXED_LINE’,
});

var updateInputValue = function (event) {
dialCode.value = “+” + iti.getSelectedCountryData().dialCode;
};
input.addEventListener(‘input’, updateInputValue, false);
input.addEventListener(‘countrychange’, updateInputValue, false);

var errorMap = [“Invalid number”, “Invalid country code”, “Too short”, “Too long”, “Invalid number”];

var reset = function() {
input.classList.remove(“error”);
errorMsg.innerHTML = “”;
errorMsg.classList.add(“hide”);
validMsg.classList.add(“hide”);
};

input.addEventListener(‘blur’, function() {
reset();
if (input.value.trim()) {
if (iti.isValidNumber()) {
validMsg.classList.remove(“hide”);
} else {
input.classList.add(“error”);
var errorCode = iti.getValidationError();
errorMsg.innerHTML = errorMap[errorCode];
errorMsg.classList.remove(“hide”);
}
}
});

input.addEventListener(‘change’, reset);
input.addEventListener(‘keyup’, reset);

i have add this code but problem is fetch the data time country code is different column to create. how to do javascript code in a form country code and number is fetched in one column.

Thank you!
-Nensi Butani

[1] Here is the link : on-demand-grocery-delivery-app