JQuery JSON Undefined

拜拜、爱过 提交于 2019-12-13 22:11:15

问题


I'm using the jquery iMask plugin found here. Here is my code: fiddle

When I run it
1) it doesn't work correctly. The input for phone is not masked like i set it up
2) the console displays the error:

Uncaught ReferenceError: Json is not defined fiddle.jshell.net:1

What is this error and how do I fix it? Thanks


回答1:


It's not a jQuery plugin, it's a mootools plugin.

Use the jQuery port instead https://github.com/cwolves/jQuery-iMask

http://jsfiddle.net/GtQKh/9/

$(document).ready(function(e) {
   $('#phone').iMask({  
     type:'fixed',  
     mask:'(999) 999-9999',  
     stripMask: false
   });
});​



回答2:


To clear up confusion, iMask was originally created for MooTools and then someone also created a jQuery plugin. It seems you want to use jQuery event handlers so I'd recommend using the jQuery iMask plugin instead. Of course once you do this you will need to update your source code. Here is a basic working fiddle using jQuery iMask instead.

Please note that I used the GitHub source just for demonstration purposes.



来源:https://stackoverflow.com/questions/12608719/jquery-json-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!