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 class="form-group">
<input type="number" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}" style="width:168%"
class="form-control form-control-sm" placeholder="@localizer["MobilePhone"]"
id="inpMobilePhone" name="MobilePhone" required />
</div>
This is the first thing i saw i want to change this:
2
Answers
Check the
initialCountry
option from the documentation of intel-tel-input library.Set the initial country selection by specifying its country code.