Validation Plugin: Invoke errorPlacement function onfocusout, keyup and click

Validation Plugin: Invoke errorPlacement function onfocusout, keyup and click

Hi,
I am using the bassistance validation plugin and want to use the errorPlacement function to add error messages to the fields title attribute and display just a  next to the field.

This works great when the form is submitted with the submit button but when any of the following events are triggered:
  • onfocusout
  • click
  • onkeyup
The validation checks are run but it skips the errorPlacement function and adds the full error message after the field.

I have tried setting focusCleanup to true, as was suggested in another thread in this forum, but that has no effect and is not really the kind of functionality I wish to add.

I am using the following code:
  1. $("#send-mail").validate({
  2.     debug: true,
  3.     // set this class to error-labels to indicate valid fields 
  4.     success: function(label) {
  5.         // set text as tick
  6.         label.html("✔").addClass("valid"); 
  7.     }, 
  8.      // the errorPlacement has to take the table layout into account 
  9.     errorPlacement: function(error, element) {
  10.         console.log("errorPlacement called for "+element.attr("name")+" field");
  11.         // check for blank/success error
  12.         if(error.text() == "")
  13.         {
  14.             // remove field title/error message from element
  15.             element.attr("title", "");
  16.             console.log("error check passed");
  17.         }
  18.         else
  19.         {
  20.             // get error message
  21.             var message = error.text();

  22.             // set as element title
  23.             element.attr("title", message);

  24.             // clear error html and add cross glyph
  25.             error.html("✘");

  26.             console.log("error check failed: "+message);
  27.         }
  28.         // add error label after form element
  29.         error.insertAfter(element);
  30.     },
  31.     ignoreTitle: true,
  32.     errorClass: "invalid",
  33.     focusCleanup: true
  34. });
Thanks