From e6432367d997cd8270a1fdc8869d9814168175e1 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Tue, 10 Nov 2015 13:52:59 -0600 Subject: [PATCH] focus checks apply to all form-controls, not a selected list (left out textarea) --- scripts/material.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/material.js b/scripts/material.js index 06da0736..a3d0914a 100644 --- a/scripts/material.js +++ b/scripts/material.js @@ -145,6 +145,9 @@ // 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 // 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){ $formGroup.removeClass("has-error"); } @@ -152,12 +155,11 @@ $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 }) - .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 - // .is(":invalid")) }) .on("change", ".form-group.fileinput [type=file]", function() { var $this = $(this);