简体   繁体   中英

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM