본문 바로가기

Javascript

Javascript Form & HTML DOM

Validation

document.forms["myForm"]["fname"].value 로 form에 입력된 값을 가져와 유효검사할 수 있다

onsubmit="return validateForm() HTML에서는 생성한 함수를 불러줘야한다

 

checkValidity() 유효한 값이면 true를 리터난다
setCustomValidity() Sets the validationMessage property of an input element.

 

Valid Properties

html에서 설정한 유효한 범위의 값에 대해 판별한다

customError Set to true, if a custom validity message is set.
patternMismatch Set to true, if an element's value does not match its pattern attribute.
rangeOverflow Set to true, if an element's value is greater than its max attribute.
rangeUnderflow Set to true, if an element's value is less than its min attribute.
stepMismatch Set to true, if an element's value is invalid per its step attribute.
tooLong Set to true, if an element's value exceeds its maxLength attribute.
typeMismatch Set to true, if an element's value is invalid per its type attribute.
valueMissing Set to true, if an element (with a required attribute) has no value.
valid Set to true, if an element's value is valid.

 

'Javascript' 카테고리의 다른 글

Javascript AJAX  (0) 2020.07.29
Javascript Browser BOM  (0) 2020.07.29
Javascript  (0) 2020.07.27