Skip to content Skip to sidebar Skip to footer

Why Does JQuery Mask Say It's Not A Function?

When trying to use the jQuery mask() function, I get the following error in the console: TypeError: $(...).mask is not a function This is a sample of my code where this is happeni

Solution 1:

Jquery mask is a plugin. You can directly add this line in your HTML if you want to use a CDN version:

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

Another way is to use a package manager like npm or bower. To accomplish that, follow the instructions in the README.md file of the project.


Solution 2:

Change this line from

$(document).ready(function(){

to

$(document).ready(function($){


Solution 3:

jQuery itself does not provide functionality for masking an input. You can use one of the plugins avaiable for it.


Post a Comment for "Why Does JQuery Mask Say It's Not A Function?"