老师,请检查代码
来源:4-3 编程练习
慕函数4436287
2019-04-15 15:00:11
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>习题</title>
</head>
<body>
<input type="text" value=""><span></span>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script>
//此处写代码
$("input").focus(function(){
$("span").text("请输入用户名")
$(this).css({"borderColor":""})
})
$("input").blur(function(){
if($(this).val()==""){
$("span").text("用户名不能为空")
$(this).css({"borderColor":"red"})
}else{
$("span").text("请输入用户名")
$(this).css({"borderColor":"green"})
}
})
</script>
</body>
</html>
1回答
好帮手慕夭夭
2019-04-15
你好同学,效果实现的是对的,继续努力哦,祝学习愉快 !
相似问题