简体   繁体   English

如何更改输入类型中的默认国家/地区='tel'

[英]How to change default country in input type='tel'

I am creating an input field type tel and this type always giving me the US as a default result i want to change it to Netherland for example,我正在创建一个输入字段类型 tel 并且这种类型总是给我美国作为默认结果我想将其更改为荷兰例如,

Is it possible to do it directly?可以直接做吗?

<input name="phone" type="tel" id="phone" required="required" class="form-group padding-inputs" autocomplete="off" data-intl-tel-input-id="0">

Is there anyway to set the default country to something different then the us?无论如何将默认国家/地区设置为与美国不同的国家/地区? and thank you for the help谢谢你的帮助

You will have to use pattern validation as described here .您将不得不使用此处描述的模式验证。 As far as I am aware there is no other method.据我所知,没有其他方法。

Quote from MDN:引用 MDN:

As we've touched on before, it's quite difficult to provide a one-size-fits-all client-side validation solution for phone numbers.正如我们之前提到的,为电话号码提供一种万能的客户端验证解决方案非常困难。

A regex example for dutch phone numbers can be found here .可以在此处找到荷兰电话号码的正则表达式示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM