[英]How can I make Turkey the default country when choosing a country code for a phone number?
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:这个 html 是我的电话输入,原因
type=number
因为当我将其更改为type=tel
时,它允许我将文本写入:
<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:这是我看到的第一件事,我想改变它:
Check the initialCountry
option from the documentation of intel-tel-input library.从 intel-tel-input 库的文档中检查
initialCountry
选项。
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",
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.