Skip to content

Commit 60fe1e4

Browse files
committed
Update jquery.form-validator.js
1 parent 0406e5c commit 60fe1e4

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

form-validator/jquery.form-validator.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,19 @@
341341

342342
// Apply error style to invalid inputs
343343
$.each(errorInputs, function(i, $input) {
344+
var $parent = $input.parent();
345+
// Twitter bs
346+
if ($parent.hasClass('input-group')){
347+
$parent = $parent.parent();
348+
}
349+
344350
if (config.borderColorOnError !== '') {
345351
$input.css('border-color', config.borderColorOnError);
346352
}
347353
$input
348-
.addClass(config.errorElementClass)
349-
.parent()
350-
.addClass('has-error');
354+
.addClass(config.errorElementClass);
355+
$parent
356+
.addClass('has-error');
351357
});
352358

353359
// display all error messages in top of form
@@ -367,8 +373,14 @@
367373
// Display error message below input field
368374
else {
369375
$.each(errorInputs, function(i, $input) {
370-
var $parent = $input.parent(),
371-
$errorSpan = $parent.find('span[class='+config.errorMessageClass+']');
376+
var $parent = $input.parent();
377+
378+
// Twitter bs
379+
if ($parent.hasClass('input-group')){
380+
$parent = $parent.parent();
381+
}
382+
383+
var $errorSpan = $parent.find('span[class='+config.errorMessageClass+']');
372384
if ($errorSpan.length > 0) {
373385
$errorSpan.text(', '+$input.valAttr('current-error'));
374386
} else {

0 commit comments

Comments
 (0)