Skip to content

Commit 35ad83a

Browse files
authored
Merge pull request #3 from lucacelenza/master
Added bootstrap4's validation feedbacks.
2 parents eb6322b + 7cb89d1 commit 35ad83a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dist/unobtrusive-bootstrap.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,19 @@
2020
$.validator.unobtrusive.options = {
2121
errorClass: defaultOptions.errorClass,
2222
validClass: defaultOptions.validClass,
23+
errorElement: 'div',
24+
errorPlacement: function (error, element) {
25+
error.addClass('invalid-feedback');
26+
27+
if ($element.next().is(".input-group-append")) {
28+
$error.insertAfter($element.next());
29+
} else {
30+
$error.insertAfter($element);
31+
}
32+
}
2333
};
2434
}
2535
else {
2636
console.warn('$.validator is not defined. Please load this library **after** loading jquery.validate.js and jquery.validate.unobtrusive.js');
2737
}
28-
})(jQuery);
38+
})(jQuery);

0 commit comments

Comments
 (0)