From 6b4e65d3e50eb4f89a5fe5313d0b64bdf06a4e66 Mon Sep 17 00:00:00 2001 From: Wade Tandy Date: Thu, 27 Mar 2014 13:39:36 -0400 Subject: [PATCH] Fix bug where input didn't complete if final character was mid-input The previous completion callback was only called if the final character typed was also the last character in the masked input. For example if I have a date mask (99/99/9999), if I type 03/27/2014 in that order, it will fire the completion callback without issue. But if I go back and backspace the 27 to a 28, the callback wouldn't fire. --- src/jquery.maskedinput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js index cd226c8..173449f 100644 --- a/src/jquery.maskedinput.js +++ b/src/jquery.maskedinput.js @@ -257,7 +257,7 @@ $.fn.extend({ input.caret(next); } - if (settings.completed && next >= len) { + if (settings.completed && (next >= len || buffer.indexOf(settings.placeholder) == -1)) { settings.completed.call(input); } }