javascriptjqueryjquery-mask

Jquery mask is undefined


I am using the mask plugin into my project. I have included it like this;

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js"></script>

Even though I am able to use the mask method like this and it works without a problem;

$("#txtTel").mask("+380 999 999 999")

I am not able to use it to change its definitios like this;

 $.mask.definitions['9'] = '';
 $.mask.definitions['#'] = '[0-9]';

It gives me this error;

Uncaught TypeError: Cannot read property 'definitions' of undefined

What can be causing this problem? Thanks in advance...


Solution

  • You're using one plugin with the documentation from another.

    The syntax you're using applies to this plugin: https://www.npmjs.com/package/jquery.maskedinput

    ... not to the one you're using.