From 1b055151c244a08acc19991ffcc30bb6f9015cef Mon Sep 17 00:00:00 2001 From: Pellumb Hasani Date: Thu, 21 Apr 2016 17:05:10 +0200 Subject: [PATCH] Modifies focusError method to focus on first error within form element (rather than first error on the page) --- js/validator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/validator.js b/js/validator.js index 17f40ff..8b1ab0a 100644 --- a/js/validator.js +++ b/js/validator.js @@ -206,7 +206,7 @@ Validator.prototype.focusError = function () { if (!this.options.focus) return - var $input = $(".has-error:first :input") + var $input = this.$element.find(".has-error:first :input") if ($input.length === 0) return $(document.body).animate({scrollTop: $input.offset().top - Validator.FOCUS_OFFSET}, 250)