现在的位置: 首页 > 综合 > 正文

表单提交前验证

2018年01月28日 ⁄ 综合 ⁄ 共 183字 ⁄ 字号 评论关闭

html页面:

<form action="list.html" method="post" onsubmit="return check()">
<input type="text" id="mid" >
</form>

js代码:

function check(){
if($("#mid").val==""){
alert("不能为空");
return false;
}
return true;
}

抱歉!评论已关闭.