验证不通过时,页面直接刷新,layui提示一闪而过
<form id="modifyForm" target="test">
<input type="text" id="phone" name="phone" />
<input type="submit" class="smbtn bluebtn fr" οnclick="formToSubmit('modifyForm');" value="提交" />
</form>
<iframe name="test" style="display:none"></iframe>
<script>
function formToSubmit(formId){
var phone = $('#phone').val();
if(!(/^1[3456789]\d{9}$/.test(phone))){
layer.alert("手机格式错误!",{icon:5});
return false;
}else{
//提交表单
}
}
</script>