console
$('#verfication').hide();
$('#login').click(function(){
if($(":text").val().length==0){
$('#username').focus();
$("#errormessage").html(
"请您填写手机/邮箱/用户名").css("color","red");
}else if( $(":password").val().length==0){
$('#password').focus();
$("#errormessage").html(
"请您填写密码"
).css("color","red");
$('#verfication').val().length==0){
$('#verfication').focus();
$("#verfication").html(
"请您填写密码"
).css("color","red");
}
});
$('#verfication').blur(funvtion(){
else if($('#verfication').val() !='yzm'&& $('#verfication').val().length!=0) {
$("#errormessage").html("您输入的验证码有误:" + $('#verfication').val());
} else{
$("#errormessage").html('');
}
});
<p id="errormessage"></p>
<input id='username' type="text" name="username">
<br>
<input type="password" id="password"
name ="password" ><br>
<input type='text' id="verfication"/>
<br/>
<button id='login'>登录</button>