Default plugin for jQuery form validation module

Hi, I am using the jQuery form validation plugin   http://bassistance.de/jquery-plugins/jquery-plugin-validation/

And I know that the default text is "This field is required." And I want to replace it with an IMG tag. But I don’t want to change it in real PLUGIN, and I wonder if this can be done only in general terms through the plugin parameters. I tried many options, but came up with this shortened version.

$(document).ready(function(e) {
    $("#validationTest").validate({
        rules: {
            defaults: {
                messages: {required: "<img src='images/required.png' />"}
            }
        },
        submitHandler: function(form) {
            $(form).submit();
        }
    })
});

But this still does not work ... any thoughts or direction will be appreciated.

+3
source share
1 answer

You mean the following:

    $(document).ready(function(){
        $('#field').validate({
            rules: {
                f1: "required"
            },
            messages: {
                f1: "<img src='images/icons-coquette/accept.png' />"
            }
        })
    });

for all try $ .extend

        $.extend(
            $.validator.messages, {
            required: "put your message here" //or put <img /> tag
        });
+1
source

All Articles