我的PHP页面中有一个删除按钮,用于删除记录。 但是,当我删除该按钮时,我会使用以下确认框:
<form action="log.php" method="post" onsubmit="return confirm('Are you sure?');">
当他们确认必须填写密码时,我可以这样做吗?
所以我的意思是这样的
<form action="log.php" method="post" onsubmit="return confirm('password :');">
然后他们必须填写密码
提前致谢。
答案 0 :(得分:1)
嗨,你需要这样的东西,根据你的要求修改
var result = $( ".form-horizontal" ).filter( function(){
return $( this ).find( '.form-control' ).size() == 0;
} );
答案 1 :(得分:0)
尝试使用input type="password"
,required
属性`;禁用提交,直到设置密码
document.forms["form"].querySelector("input[type=button]").onclick = function(e) {
e.preventDefault();
this.nextElementSibling.disabled = false;
this.nextElementSibling.nextElementSibling.disabled = false;
}
&#13;
<form name="form">
<input type="button" value="Are you sure?" />
<input type="password" minlength="3" maxlength="7" required disabled />
<input type="submit" disabled />
</form>
&#13;
答案 2 :(得分:0)
document.forms["form"].querySelector("input[type=button]").onclick = function(e) {
e.preventDefault();
this.nextElementSibling.disabled = false;
this.nextElementSibling.nextElementSibling.disabled = false;
}
<form name="form">
<input type="button" value="Are you sure?" />
<input type="password" minlength="3" maxlength="7" required disabled />
<input type="submit" disabled />
</form>