나가기
🌐 웹 개발 기초›유효성 검사와 스타일1/8
HTML만으로도 입력을 검증할 수 있습니다
html
1<form action="/signup" method="POST">2 <!-- required: 필수 입력 -->3 <input type="text" name="name" required>45 <!-- minlength / maxlength: 글자 수 제한 -->6 <input type="password" name="pw"7 minlength="8" maxlength="20" required>89 <!-- pattern: 정규식 패턴 매칭 -->10 <input type="tel" name="phone"11 pattern="[0-9]{3}-[0-9]{4}-[0-9]{4}"12 placeholder="010-1234-5678">1314 <!-- min / max: 숫자 범위 -->15 <input type="number" name="age"16 min="1" max="150">1718 <button type="submit">제출</button>19</form>탭하여 계속 ▸
1 / 8