Open kouts opened 6 years ago
This event doesn't fire when value of input is empty. Doesn't matter how you did it empty.
I ran into this too... there's a few places where it's relevant in the source:
https://github.com/igorescobar/jQuery-Mask-Plugin/blob/master/src/jquery.mask.js#L389
This sets the first oldValue
, if the initial value of your input is "" then the oldValue
will be empty string. Now, the oldValue
doesn't change again until the input is blur'd.
I vendor'd the plugin and made the following changes to get around it:
https://github.com/igorescobar/jQuery-Mask-Plugin/blob/master/src/jquery.mask.js#L123 Became:
oldValue = p.val() || null;
https://github.com/igorescobar/jQuery-Mask-Plugin/blob/master/src/jquery.mask.js#L389 Became:
var jMask = this, oldValue = p.val() || null, regexMask;
Note that both changes employ p.val() || null
since ''
is false-y
This could also be done in 1 alteration instead of 2 with the following added after line 384: https://github.com/igorescobar/jQuery-Mask-Plugin/blob/master/src/jquery.mask.js#L384
oldValue = val // # now line 385
This change on line 373/374 would also make it work:
var val = p.val(),
tmpVal = val || null, // <---
changed = tmpVal !== oldValue, // <---- using the tmpVal to check for a change
I'm using this one ^ in my vendor'd version. I keeps that data the same, and only uses that tmpVal
which can be null, to check for changed.
Device
Desktop
Browser (and version)?
Firefox, Chrome
Functional
jsfiddle
exemplifying your problem:http://jsfiddle.net/q6cLkyo4/3/
Describe de problem depth:
onChange callback event not firing when selecting all the text inside the input and hitting the
delete
key.