Cannot read properties of undefined (reading 'length')
let id=$("#id").val();
$(function(){
$("#id").focusout(function(){
if(id.length<1){
alert("ID를 입력하셔야합니다.");
return false;
}
});//focusout
});//function
위의 경우 $("#id").val() 값에 데이터가 없다면
undefined로 뜨고,
그럼 그 값의 length는 측정이 불가능해진다.
/*수정코드 */
$(function(){
$("#id").focusout(function(){
if($("#id").val().length<1){
alert("ID를 입력하셔야합니다.");
return false;
}
});//focusout
});//function