자바스크립트로 id입력창의 유효성을 검사할수있다.
function nLoginbtnClikc(){
const username= loginInput.value; //로그인창에 입력한 값을 정의한다
if(username==""){ //로그인창에 값이 없으면
alert("plase write your name") //오류창 띄움
}else if(username.length>15){ //로그인길이가 15개 이상이면
alert("Your name is long") //오류창 띄움
}
}
<div id="login-form">
<form action="">
<input type="text" placeholder="what is your name" required maxlength="15">
<button>log in</button>
<script src="app.js"></script>
</form>
</div>