Skip to content Skip to sidebar Skip to footer

Bootstrap JQuery Validate Plugin.. Error Placement Issue

So i have implemented the jquery validation plugin to my code as shown in my code below, however i have an issue in displaying the error code to be after all the options. at the mi

Solution 1:

I tried this using bootstrap v3.3.4, jQuery v2.1.4 and validate v1.13.1 and I was able to get the following errorPlacement syntax to work based on how your HTML is structured:

errorPlacement: function(error, element) {
    if (element.is(":radio")) {
        error.insertAfter(element.closest("div"));
    } else {
        error.insertAfter(element);
    }
}

Hope this helps the cause.


Solution 2:

this should work

 errorPlacement: function (error, element) {
                if (element.is(":radio") || element.is(":checkbox")) {
                    error.appendTo(element.parent());
                } else {
                    error.insertAfter(element);
                }
            }

Post a Comment for "Bootstrap JQuery Validate Plugin.. Error Placement Issue"