focus checks apply to all form-controls, not a selected list (left out textarea)

This commit is contained in:
Kevin Ross 2015-11-10 13:52:59 -06:00
parent 9bbd049fea
commit 8a6457acc0

View File

@ -145,6 +145,9 @@
// Validation events do not bubble, so they must be attached directly to the input: http://jsfiddle.net/PEpRM/1/ // Validation events do not bubble, so they must be attached directly to the input: http://jsfiddle.net/PEpRM/1/
// Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter // Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter
// the form-group on change. // the form-group on change.
//
// NOTE: I'm not sure we should be intervening regarding validation, this seems better as a README and snippet of code.
// BUT, I've left it here for backwards compatibility.
if(isValid){ if(isValid){
$formGroup.removeClass("has-error"); $formGroup.removeClass("has-error");
} }
@ -152,12 +155,11 @@
$formGroup.addClass("has-error"); $formGroup.addClass("has-error");
} }
}) })
.on("focus", ".form-group input, .form-group select, .form-group.fileinput", function() { .on("focus", ".form-control, .form-group.fileinput", function() {
$(this).parent().addClass("is-focused"); // add class to form-group $(this).parent().addClass("is-focused"); // add class to form-group
}) })
.on("blur", ".form-group input, .form-group select, .form-group.fileinput", function() { .on("blur", ".form-control, .form-group.fileinput", function() {
$(this).parent().removeClass("is-focused"); // remove class from form-group $(this).parent().removeClass("is-focused"); // remove class from form-group
// .is(":invalid"))
}) })
.on("change", ".form-group.fileinput [type=file]", function() { .on("change", ".form-group.fileinput [type=file]", function() {
var $this = $(this); var $this = $(this);