如何使用jQuery Masked Input插件在我的掩码中允许负数?
答案 0 :(得分:2)
首先转到该插件的“文档”页面。 http://digitalbush.com/projects/masked-input-plugin/
然后引用以“您现在可以提供自己的蒙版定义”开头的部分。
jQuery(function($){
$.mask.definitions['~']='[+-]';
$("#eyescript").mask("~9.99 ~9.99 999");
});
所以你可能想要像......那样的东西。
jQuery(function($){
$.mask.definitions['~']='[+-]?';
$("#eyescript").mask("~999999999");
});
我假设末尾的问号'[+ - ]?'将按预期的方式运行正则表达式片段。