现在我修改 jquery.valiadte.unobtrusive.js 中的 onerror 和 onsucces 方法,如下所示:
function onSuccess(error) { // 'this' is the form element
var container = error.data("unobtrusiveContainer"),
replace = $.parseJSON(container.attr("data-valmsg-replace"));
if (container) {
container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
var parent = container.parent();
parent.css("display", "block");
parent.addClass("validLabel").removeClass("invalidLabel");
parent.children().css("display", "none");
var label = parent.parent().children("label:first-child,.label:first-child");
label.removeClass("errorLabel");
var info = parent.parent().children(".infoLabel");
info.css("display", "none");
$("#aCGVValidate").removeClass("validLabel");
if (replace) {
container.empty();
}
}
}
和错误:
function onError(error, inputElement) { // 'this' is the form element
var container = $(this).find("[data-valmsg-for='" + inputElement[0].name + "']"),
replace = $.parseJSON(container.attr("data-valmsg-replace")) !== false;
container.removeClass("field-validation-valid").addClass("field-validation-error");
error.data("unobtrusiveContainer", container);
var parent = container.parent();
parent.css("display", "block");
parent.addClass("invalidLabel").removeClass("validLabel");
parent.children().css("display", "inline-block");
error.data("unobtrusiveContainer", container);
var label = parent.parent().children("label:first-child,.label:first-child");
label.addClass("errorLabel");
var info = parent.parent().children(".infoLabel");
info.css("display", "none");
if (replace) {
container.empty();
error.removeClass("input-validation-error").appendTo(container);
}
else {
error.hide();
}
}
我需要在库外进行修改以更改样式,如何在库外覆盖此方法?(我的目标是拥有这样的 css :)