简体   繁体   中英

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,

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:

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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