From 3c521eba153f0dad837b03cd56ad3da6593dfc45 Mon Sep 17 00:00:00 2001 From: Ilya Konanykhin Date: Thu, 22 Dec 2016 23:23:48 +0600 Subject: [PATCH] BS3: js validation errors. --- app/assets/javascripts/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/utils.js b/app/assets/javascripts/utils.js index 0b99956..edbb656 100644 --- a/app/assets/javascripts/utils.js +++ b/app/assets/javascripts/utils.js @@ -1,7 +1,7 @@ function displayFormErrors(data){ - if( data.errors != undefined ){ - $.each( data.errors, function( field, errorMsg) { - $("#"+field).parents(".control-group").addClass("error"); + if(data.errors != undefined ){ + $.each(data.errors, function(field, errorMsg) { + $("#"+field).closest(".form-group").addClass("has-error"); $("#"+field).siblings(".help-block").html(errorMsg); }); }