简体   繁体   中英

Validation error: Attribute onfocusout not allowed on element input at this point

I want to make use of "onfocusout" at an input element. Unfortunately my validators return the following error message: "Attribute onfocusout not allowed on element input at this point."

The html code looks like this:

<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. However, it should work as an HTML attribute and by using the addEventListener() method (See syntax examples below).

In JavaScript, using the addEventListener() method:

object.addEventListener("focusout", myScript);

Source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM