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

660 Views Asked by At

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?

1

There are 1 best solutions below

0
Rob Moll On BEST ANSWER

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