input ํ๊ทธ-6 (์ฃผ์ ์์ฑ๋ค)
input ํ๊ทธ์ ์ฌ๋ฌ ์์ํ ๊ธฐ๋ฅ๋ค์ ์ถ๊ฐํ ์ ์๋ ์์ฑ๋ค์ ์์๋ณด์
autofocus : ์๋์ผ๋ก ์ปค์ ๊ฐ์ ธ๋ค๋๊ธฐ
์ด ์์ฑ์ ์ฌ์ฉํ๋ฉด ํ์ด์ง๋ฅผ ๋ถ๋ฌ์ค์๋ง์ ์ํ๋ ์์์ ๋ง์ฐ์ค ํฌ์ธํฐ๋ฅผ ์ฌ์ฉํ ์ ์๋ค.
<input type=ํ
์คํธ์
๋ ฅํ๋ autofocus>
placeholder : ํํธ ํ์
ํ ์คํธ๋ฐ์ค์ ์ ๋นํ ํํธ ๋ด์ฉ์ ํ์ํ๊ณ , ํ๋๋ฅผ ํด๋ฆญํ๋ฉด ํํธ๊ฐ ์ฌ๋ผ์ง๋๋ก ํ ์ ์๋ค.
'์์ด๋๋ฅผ ์ ๋ ฅํ์ธ์' ๋ฑ์ ํํธ๋ฅผ ๋ก๊ทธ์ธ ํ ์คํธ๋ฐ์ค์ ํ์ํ๋ ๊ฒ์ด ๊ทธ ์์์ด๋ค.
<input type=ํ
์คํธ์
๋ ฅํ๋ placeholder="ํํธ๋ด์ฉ">
autofocus์ placeholder๋ฅผ ์ฌ์ฉํ๋ ์์ ์ด๋ค
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>Html-basic</title>
</head>
<body>
<form action="">
<fieldset>
<legend>๋ฐฐ์ก ์ ๋ณด</legend>
<label for="">์ด๋ฆ<input type="text" autofocus></label><br>
<label for="">๋ฐฐ์ก ์ฃผ์<input type="text"></label><br>
<label for="">์ด๋ฉ์ผ<input type="email" name="" id=""></label><br>
<label for="">์ฐ๋ฝ์ฒ<input type="tel" name="" id="" placeholder="ํ์ดํ ๋บด๊ณ ์
๋ ฅํด ์ฃผ์ธ์"></label><br>
<label for="">๋ฐฐ์ก ์ง์ <input type="date" name="" id="">(์ฃผ๋ฌธ์ผ๋ก๋ถํฐ ์ต์ 3์ผ ์ดํ)</label>
</fieldset>
</form>
</body>
</html>
readonly : ์ฝ๊ธฐ ์ ์ฉ ํ๋
์ ๋ ฅ์ ๋ชปํ๊ณ ์ฝ๊ฒ๋ง ํ๋ ์ฝ๊ธฐ ์ ์ฉ ํ๋๋ฅผ ๋ง๋ค ์ ์๋ค.
<input type=ํ
์คํธ์
๋ ฅํ๋ readonly>
required : ํ์ ์ ๋ ฅ ํ๋
submit ๋ฒํผ์ด ํด๋ฆญ๋์์ ๋ required์์ฑ์ด ์๋ ํ๋๋ ๋ด์ฉ์ด ์ฑ์์ ธ์๋์ง ๊ฒ์ฌ๋ฉ๋๋ค.
๋ง์ฝ ํ์ ํ๋๋ฅผ ์ฒด์ฐ์ง ์๊ณ submit ๋ฒํผ์ ๋๋ฅผ ๊ฒฝ์ฐ, ์ ์ถ์ด ๋์ง ์๊ณ ๊ฒฝ๊ณ ๋ฉ์ธ์ง๊ฐ ๋์ต๋๋ค.
<input type=ํ
์คํธ์
๋ ฅํ๋ required>
readonly์ required ์์ฑ์ ์ฌ์ฉํ๋ ์์ ์ด๋ค
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>Html-basic</title>
</head>
<body>
<form action="">
<fieldset>
<legend>๋ฐฐ์ก ์ ๋ณด</legend>
<label for="">์ด๋ฆ<input type="text" value="HUSH" readonly></label><br>
<label for="">๋ฐฐ์ก ์ฃผ์<input type="text" required></label><br>
<label for="">์ด๋ฉ์ผ<input type="email" name="" id=""></label><br>
<label for="">์ฐ๋ฝ์ฒ<input type="tel" name="" id="" placeholder="ํ์ดํ ๋บด๊ณ ์
๋ ฅํด ์ฃผ์ธ์"></label><br>
<label for="">๋ฐฐ์ก ์ง์ <input type="date" name="" id="">(์ฃผ๋ฌธ์ผ๋ก๋ถํฐ ์ต์ 3์ผ ์ดํ)</label>
<input type="submit" value="์ ์ถํ๊ธฐ">
</fieldset>
</form>
</body>
</html>