mygomii

[script&Jquery] #빈값(null) 체크하기 본문

JavaScript&JQuery

[script&Jquery] #빈값(null) 체크하기

mygomii 2018. 4. 24. 17:18
반응형

빈값 체크하기


1
2
3
4
5
id : <imput type="text" id="id">
password : <imput type="password" id="password">
 
<input type="button" id="btn">
 

cs

값이 비어있으면 return false 
값이 있으면 return true


1
2
3
4
5
6
7
8
9
$('#btn').click(function(){
    if($('#id').val == ''){
          return false;
      }
    if($('#password').val == ''){
          return false;
      }
    return true;
});
cs


반응형