diff --git a/README.md b/README.md index 64828ed..dc46992 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,10 @@ This is a masked input plugin for the jQuery javascript library. It allows a use * a - Represents an alpha character (A-Z,a-z) * 9 - Represents a numeric character (0-9) -* \* - Represents an alphanumeric character (A-Z,a-z,0-9) \ No newline at end of file +* \* - Represents an alphanumeric character (A-Z,a-z,0-9) + +Events +-------- + +- `unmasked.maskedInput` is triggered when the input is blurred and the mask is cleared. If you're performing separate validation, it may be useful to bind validation to this event. For example, if you're checking whether a field is empty, you don't want to consider the temporary placeholders in a field. When this event is triggered, they will be gone. + diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js index af67604..f95c0b1 100644 --- a/src/jquery.maskedinput.js +++ b/src/jquery.maskedinput.js @@ -242,8 +242,10 @@ }) .bind("blur.mask", function() { checkVal(); - if (input.val() != focusText) + if (input.val() != focusText) { input.change(); + input.trigger('unmasked.maskedInput'); + } }) .bind("keydown.mask", keydownEvent) .bind("keypress.mask", keypressEvent)