Form Validation

Garam·2023년 8월 23일
0

The Odin Project

목록 보기
5/14
post-thumbnail

HTML Validations


required : must be filled

minlength / maxlength : text minimum / maximum length, can be combined

min / max : number minimum / maximum

pattern : with a regular expression. only be used on <input> elements.

<input type="text" id="zip_code" name="zip_code" 
pattern="(\d{5}([\-]\d{4})?)" required>


CSS Validations

input:invalid {
  border-color: red;
}

input:valid {
  border-color: green;
}



0개의 댓글