Javascript – jquery masked input plugin to not clear field when errored


I'm looking at the

I'm calling it like this:


And I don't want it to throw away the users input if something is wrong, e.g. they haven't finished


If you leave the field after having typed this much, it clears it. I'd like to leave it so they can finish later.

I'm new to jQuery, and I've looked through his source, but I can't find any way to do that, nor can I find any way to edit it to accomplish what I want, because the code is arcane to my eyes.

Best Solution

Set autoclear option to false.

$(control).mask('999-999-9999', {autoclear: false});