如何在 HTML 中使用电话输入类型?

htmlweb developmentfront end technology

在 HTML 中使用电话输入类型时,需要使用 <input type="tel"> 。这样,用户就可以添加电话号码了。

注意 − 输入类型 tel 仅在 Safari 浏览器中受支持。

示例

您可以尝试运行以下代码,了解如何使用输入类型 tel 允许用户以电话号码的形式输入 −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML input search</title>
   </head>

   <body>
      <form action = "" method = "get">
         Details:<br><br>
         Student Name<br><input type = "name" name = "sname"><br>
         Student Telephone<br> <input type = "tel" name = "telephone"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>

相关文章


有用资源