问题
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