简体   繁体   中英

Html input type="tel" vs inputmode="tel"

Knowing both is used as a hint for mobile browsers, I couldn't find a real doc about the difference between using <input type="tel"> and <input inputmode="tel"> . So

  • what's the difference?
  • which is better to use?
  • why duplication if it's the same?

The MDN doc suggests using the type. But it's still unclear on the explaination.

If you want only show the "phone keys" like 0 to 9 and * and #, use

<input inputmode="tel">

If you want to show a form field with regular keyboard, use

<input type="tel">

Also see " Everything You Ever Wanted to Know About inputmode ".

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