Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clearErrors() {
- //$("form input[error]").each(function (i, obj) {
- $("form *[error]").each(function (i, obj) {
- if ($(obj).hasClass("error")) {
- $(obj).removeClass("error");
- }
- });
- }
- function showErrors(data, boxId) {
- clearErrors();
- var errorBox = $("#" + boxId + " ul");
- errorBox.html("");
- $.each(data.errors, function (index, obj) {
- errorBox.append("<li>" + obj.value + "</li>");
- // El * para que tome en cuenta inputs YYYYYYYYYY selects ¬¬ ah y doble comillas pk se despedorra cuando el obj.key tiene un "." o caracter especial
- var element = $("*[error=\"" + obj.key + "\"]");
- console.log(element);
- element.addClass("error");
- /*if (!component.hasClass("error")) {
- component.addClass("error");
- }*/
- });
- errorBox.parent().slideDown();
- }
Add Comment
Please, Sign In to add comment