Search code examples
htmllivevalidation

LiveValidation plugin - HTML in failureMessage


I am using the LiveValidation plugin and was wondering of there is a way to add HTML in the span tags that show a valid or invalid message. I have the following:

var validatedObj = new LiveValidation('momlastname', { validMessage: ""});
validatedObj.add(Validate.Presence,{ failureMessage: "You need a name in this <strong>field</strong>"});

But when I test the code I get this:

Imgur

What am I missing?


Solution

  • Thanks @Danijel. I modified the function as follows:

    createMessageSpan: function () {
                var span = document.createElement('span');
                span.innerHTML = this.message;
                return span;
            },