<body>
<p>
<input type="text" id="username"/>
</p>
<p>
<input type="password" id="password"/>
</p>
<p>
<button id="btn" type="button">提交</button>
</p>
<script>
$('#btn').click(function(){
if($('#username').val().length==0){
alert('输入不能为空')
}else if($('#password').val().length<6){
alert('长度不可以少于6位')
}
})
</script>
</body>
要求: 点击id为btn的按钮, 1.判断id为username的输入是否为空,如果为空,则弹出你输入的不能为空. 2.判断id为pass
最新推荐文章于 2020-09-03 17:28:39 发布