[英]Validation error: Attribute onfocusout not allowed on element input at this point
I want to make use of "onfocusout" at an input element.我想在输入元素上使用“onfocusout”。 Unfortunately my validators return the following error message: "Attribute onfocusout not allowed on element input at this point."
不幸的是,我的验证器返回以下错误消息:“此时元素输入上不允许使用 onfocusout 属性。”
The html code looks like this: html 代码如下所示:
<div class="form-group">
<label for="dbHost" class="control-label col-sm-4">DB-Server</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="dbHost" name="dbHost" onfocusout="validateForm();" value="db">
</div>
<div>
Any idea?任何想法?
Note: The onfocusout event may not work as expected in Chrome, Safari and Opera 15+ using the JavaScript HTML DOM syntax.
注意:使用 JavaScript HTML DOM 语法的 Chrome、Safari 和 Opera 15+ 中,onfocusout 事件可能无法正常工作。 However, it should work as an HTML attribute and by using the addEventListener() method (See syntax examples below).
但是,它应该用作 HTML 属性并使用 addEventListener() 方法(请参阅下面的语法示例)。
In JavaScript, using the addEventListener() method:
在 JavaScript 中,使用 addEventListener() 方法:
object.addEventListener("focusout", myScript);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.