mercredi 1 juillet 2015

jquery validate change error messages on invalidHandler

I saw the documentation on jquery validate plugin for invalidHandler on the website. I was hoping to be able to do something like the following?

$(".selector").validate({
  invalidHandler: function(event, validator) {
    var errors = validator.numberOfInvalids();
    if (errors) {
     for (var i = 0, len = errors.length; i < len; i++) {
         errors[i].text = //replace special characters in message (if any) and replace with something else)
      } 
    }

    //update list of changed error messages back to validator, so new error messages show
  }
});

I'm trying to do it this way because I'm trying to do it globally. Basically I'm trying to convert a simpler markup into a hyperlink, and was hoping to be able to do this globally.

Is that possible?

Aucun commentaire:

Enregistrer un commentaire