Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

HTML5新要素 input type="tel"

概要

input type="tel"タグについて説明します。

内容

input type="tel"は電話番号入力欄です。
入力、表示上はinput type="text"と変わらりません。

サンプル

<!DOCTYPE HTML>
<html lang="ja-JP">
  <head>
    <meta charset="UTF-8" />
    <title>input type="tel"</title>
    <script type="text/javascript">
    function setInputText(input_id,output_id) {
      document.getElementById(output_id).innerText = document.getElementById(input_id).value;
    }
    </script>
  </head>
  <body>
  <form action="">
    Tel:<input type="tel" name="tel" id="tel" value="" placeholder="電話番号をご入力ください" style="width:200px;" required />
  </form>
  </body>
</html>

完成画面のキャプチャ