ywork2020.com

Title

インプット要素を使えば、色々な入力要素を作成できる

input要素の概要

input要素はWebページの閲覧ユーザーに入力コントロールを提供します。
これによりユーザーが入力した値を元にプログラムを処理するなどしてサイト運営者とユーザーの間で情報のやり取りができるようになります。

input要素は既定値でtext型の入力コントロールを表示しますが、type属性で入力型を指定することによって多くの入力コントロールを実装することができます。 次の項目で一覧表にまとめてありますので参考にしてください。

input要素に指定できるtype属性

type属性値実機サンプルサンプルコード
text (既定値)<input type="text">
button<input type="button">
checkbox<input type="checkbox">
color<input type="color">
date<input type="date">
value見本="1920-01-01"
datetime-local<input type="datetime-local">
value見本="2020-01-01T12:00"
email<input type="email">
file<input type="file">
image
送信機能あり:

送信機能なし:
<input type="image" src="画像のURL">
このimage型はform要素に内包されるとsubmit機能を実装します。
month<input type="month">
value見本="1920-01"
number<input type="number">
password<input type="password">
radio <input type="radio" name="Radio">
<input type="radio" name="Radio">
<input type="radio" name="Radio">
range<input type="range">
reset<input type="reset">
search<input type="search"
submit<input type="submit">
tel<input type="tel">
time<input type="time">
value見本="12:00"
url<input type="url">
week<input type="week">
value見本="1920-W01"