对于电话号码验证,我在屏蔽输入插件(jquery)中缺少什么功能?
我在prototype.js 中进行了此操作,但它与一些脚本文件发生冲突。这就是我使用 http://digitalbush.com/projects/ 在新脚本中设置它的方法masked-input-plugin/
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.maskedinput.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
jQuery(function($){
$("#phone").mask("(999)999-9999");
$.mask.definitions['~']='[+-]';
$("#eyescript").mask("~9.99 ~9.99 999");
});
</script>
根据我在prototype.js中的脚本,这显然缺少一些东西,这是我必须删除的一个示例。
<script type="text/javascript" src="/media/system/js/prototype.js"></script>
<script type="text/javascript" src="/media/system/js/prototype.maskedinput.js"></script>
<script type="text/javascript">
Event.observe(window, 'load', function() {
new MaskedInput('#phone', '(999)999-9999');
new MaskedInput('#eyescript', '~9.99 ~9.99 999', {
completed: function(){
alert("You typed the following: " + this.getValue());
}
});
MaskedInput.definitions['~']='[+-]';
new MaskedInput('#eyescript2', '~9.99 ~9.99 999', {
completed: function(){
alert("You typed the following: " + this.getValue());
}
});
});
</script>
就像我说的,这个脚本确实有效,但给我带来了与太多东西(mootools/jquery)的冲突,所以我想让 jquery 版本适用于此操作,看看它是否解决了问题。
I had this working in prototype.js but it conflicted with a few script files. This is how I set it up in the new script using http://digitalbush.com/projects/masked-input-plugin/
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.maskedinput.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
jQuery(function($){
$("#phone").mask("(999)999-9999");
$.mask.definitions['~']='[+-]';
$("#eyescript").mask("~9.99 ~9.99 999");
});
</script>
This is obviously missing something based on my script in prototype.js, here is an example I had to remove.
<script type="text/javascript" src="/media/system/js/prototype.js"></script>
<script type="text/javascript" src="/media/system/js/prototype.maskedinput.js"></script>
<script type="text/javascript">
Event.observe(window, 'load', function() {
new MaskedInput('#phone', '(999)999-9999');
new MaskedInput('#eyescript', '~9.99 ~9.99 999', {
completed: function(){
alert("You typed the following: " + this.getValue());
}
});
MaskedInput.definitions['~']='[+-]';
new MaskedInput('#eyescript2', '~9.99 ~9.99 999', {
completed: function(){
alert("You typed the following: " + this.getValue());
}
});
});
</script>
Like I said, this script did work but gave me conflicts with too many thing (mootools/jquery) so I want to make the jquery version work for this action instead and see if it resolves the issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够让它与这个一起工作......
I was able to get it working with this...