Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 选择框后,input oninvalid自定义消息仍然保持无效_Html_Angularjs_Twitter Bootstrap 3 - Fatal编程技术网

Html 选择框后,input oninvalid自定义消息仍然保持无效

Html 选择框后,input oninvalid自定义消息仍然保持无效,html,angularjs,twitter-bootstrap-3,Html,Angularjs,Twitter Bootstrap 3,处理“获取输入”(复选框)以在自定义消息无效(未选中)时显示该消息,但在该消息之后,如果用户选中该复选框,则消息仍会显示并被视为无效。我认为这和oninvalid有关,但不确定 输入代码 首先获取错误消息,然后选中复选框后得到的图片 `这对我很有效 <input style="width:15px; height:15px; cursor: pointer;" name="legal" class="form-check-input" type=

处理“获取输入”(复选框)以在自定义消息无效(未选中)时显示该消息,但在该消息之后,如果用户选中该复选框,则消息仍会显示并被视为无效。我认为这和oninvalid有关,但不确定

输入代码

首先获取错误消息,然后选中复选框后得到的图片

`这对我很有效

            <input style="width:15px; height:15px; cursor: pointer;" name="legal"
        class="form-check-input" type="checkbox" required id="legal"
        onchange="this.setCustomValidity(validity.valueMissing ? 'Please review the legal agreement and check this box to proceed' : '');">

哪里是
setCustomValidity
code?@GibralterTop
setCustomValidity
方法只为invalid分配消息,
    document.getElementById("legal").setCustomValidity("Please review the legal agreement and check this box to proceed");