html
表格而无需查看隐私政策同意书checkbox
,尽管有JS代码要求用户检查此checkbox
要提交的表格?我的浏览器是Edge。
此处提供代码:
#agreeCheckbox{
position: absolute;
display: inline;
margin-left: 5px;
margin-bottom: 12000px;
padding:5px;
background-color: white;
}
#agreeCheckbox {
display: none;
margin-bottom: 20px;
}
input + .label-text:before{
content:"\f046 ";
font-family: Fontawesome;
margin-right: 5px;
display: inline-block;
width: 1em;
font-size: 15px;
line-height: 1;
font-weight: normal;
font-style: normal;
font-variant: normal;
}
input:checked + .label-text:before{
content: "\f096 ";
font-family: Fontawesome;
line-height: 1;
font-weight: normal;
font-style: normal;
font-variant: normal;
font-size: 15px;
}
.label-text{
font-size: 15px;
color: #FFF;
font-weight: normal!important;
cursor: pointer!important;
}
.no-content:after{
content: "";
margin-top:5px;
}
<script>
function consentValidation() {
var x = document.getElementById("myCheck").required;
document.getElementById("demo").innerHTML = "You must consent to our Privacy Policy before submitting this form.";
}
</script>
<label class="no-content" style="display: inline;">
<input name="agreePP" id="myCheck" type="checkbox" value="agreePP" required>
<span class="label-text">I accept and agree to the Privacy Policy*</span>
<p id="demo" class="label-text" style="color:red!important;"></p>
</label>
<input onClick="consentValidation()" class="std_button" type="submit" value="Submit"/>
此外,为什么删除checked
属性时,复选框的默认状态为选中状态,反之亦然。当我插入checked
属性时,默认状态保持未选中状态吗?这也是自定义CSS
checkbox
,因此为什么挖矿要比大多数挖矿复杂一些。抱歉,这是我们对隐私政策的同意,因此出于明显原因,必须100%正确。说实话,这简直不是开玩笑,但是如果有人可以对此有所了解,那就太好了。
谢谢
<form>
...
</form>
以及您可能需要的其他属性,例如操作,方法。检查docs。
<form>
<label class="no-content" style="display: inline;">
<input name="agreePP" id="myCheck" type="checkbox" value="agreePP" required>
<span class="label-text">I accept and agree to the Privacy Policy*</span>
<p id="demo" class="label-text" style="color:red!important;"></p>
</label>
<input onClick="consentValidation()" class="std_button" type="submit" value="Submit"/>
</form>