簡體   English   中英

如果輸入類型 tel html5 中存在,則驗證國家代碼並刪除國家代碼后的 0

[英]Verifying country code and remove 0 after country code if exist at input type tel html5

如何驗證用戶是否填寫了以 +46 開頭的電話號碼,而不是在 +46 之后使用 0

  • 喜歡 +46700401008 而不是 0700401008。
  • 如果用戶填寫 +460700401008,也刪除 0。

我了解類型 tel 支持我了解使用正則表達式的模式。請參見下面的示例。

輸入你的電話號碼:

格式:123-456-7890

如果你想使用type="tel"

<input type="tel" id="phone" name="phone"
       pattern="\+46\d{9}"
       required>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM