mardi 12 juillet 2016

jQuery validation not using errorPlacement HTML


I have the following jQuery Validation code:

$('form').validate({
    errorElementClass: 'input-validation-error',
    errorClass: 'field-validation-error',
    errorPlacement: function (error, element) {
        error.html('<i class="icon-warning"></i> ' + error.text()).insertAfter(element);
    }
});

Which should be inserting my custom error message html after each element that errors on my page. However I'm finding the plugin doesn't like this and instead overrides whatever I want to put inside the HTML with just the error message itself and removes the <i class="icon-warning"></i>

How can I stop this?


Aucun commentaire:

Enregistrer un commentaire