SOURCE

console 命令行工具 X clear

                    
>
console
$("#verification").hide();

$('#login').click(function(){
  

  if($(":text").val().length ==0 )
    {$("#firstname").focus();
     $("#errormessage").html("请你填写手机");
    }
  else if($(":password").val().length ==0 )
  {
    $("#lastname").focus();
    $("#errormessage").html("请你填写密码");
    $("#verification").show();
  }
  else if($("#verification").val().length==0)
    {
      $("#verification").focus();
       $("#errormessage").html("请你填写验证码");
    }
  
});
$('#verification').blur(function(){
  if($("#verification").val()!='yzm')
  {$("#errormessage").html("你输入的验证码有误");}
  else{
    $("#errormessage").html('')
  }
})
<p id="errormessage"></p>
 账号<input id="firstname" type="text" name="firstname"><br/>
 密码<input id="lastname" type="password" name="lastname">
  <br/>
验证<input type="text" id="verification">
<br/>
  <button id="login">登录</button>