This script allows me to pick country code when I want to write my number:
const phoneInputField = document.querySelector("#inpMobilePhone");
const phoneInput = window.intlTelInput(phoneInputField, {
utilsScript:
"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js",
});
}
This html is my phone input and the reason type=number
because when I change that to type=tel
it's allows me to write text to:
<div >
<input type="number" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}" style="width:168%"
placeholder="@localizer["MobilePhone"]"
id="inpMobilePhone" name="MobilePhone" required />
</div>
This is the first thing i saw i want to change this:
CodePudding user response:
Check the initialCountry
option from the documentation of intel-tel-input library.
CodePudding user response:
Set the initial country selection by specifying its country code.
const phoneInput = window.intlTelInput(phoneInputField, {
initialCountry: "TR",
utilsScript:
"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js",
});