Skip to content

Commit 9f6cbf3

Browse files
author
Federico Zivolo
committed
improved detection of empty fields.
1 parent bf95587 commit 9f6cbf3

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

scripts/material.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ $(function (){
3131
});
3232

3333
$(document).on("keyup change", ".form-control", function() {
34-
if ($(this).val() !== "") {
35-
$(this).removeClass("empty");
36-
} else {
37-
$(this).addClass("empty");
38-
}
39-
});
40-
$(document).on("keydown change", ".form-control", function() {
41-
$(this).removeClass("empty");
34+
var self = $(this);
35+
setTimeout(function() {
36+
if (self.val() === "") {
37+
self.addClass("empty");
38+
} else {
39+
self.removeClass("empty");
40+
}
41+
}, 1);
4242
});
4343
$(document)
4444
.on("focus", ".form-control-wrapper.fileinput", function() {

0 commit comments

Comments
 (0)