JQuery的蒙面输入 - 没有非法字符的文件名 [英] JQuery Masked Input - No Illegal Filename Characters

查看:202
本文介绍了JQuery的蒙面输入 - 没有非法字符的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用蒙面输入jQuery插件,使我的文本框不会接受,不会在Windows系统文件名不允许任何特殊字符。我在寻找的.mask参数要做到这一点,但还没有任何运气呢。此code不会允许特殊字符,但它仅允许用户在两​​个字符输入。我的文本框的minimium长度为15

 的jQuery(函数($){
    $('#KnowledgebaseTitle')掩码(A *),{占位符:};
});


解决方案

如果您需要15字符的长度没有特殊字符的话:

 的jQuery(函数($){
    $('#KnowledgebaseTitle')掩码(***************){占位符:}。
});

A是aphla字符。

如果您需要进行定制模板过滤器,然后使用:

  $ mask.definitions ['H'] =[A-发f0-9]; //你的正则表达式过滤器等...

我想这正则表达式前pression将适用于Windows特殊字符的工作:

  $ mask.definitions ['H'] =^ [\\\\\\\\ /:*?\\?<> |] [\\\\\\\\ / ?:* \\<> |] *;jQuery的(函数($){
    $('#KnowledgebaseTitle')掩码(hhhhhhhhhhhhhhh){占位符:}。
});

I'm trying to use the masked input JQuery plugin so that my textbox will not accept any special characters which will not be allowed in a Windows Filename system. I'm searching for the .mask parameter to do this but haven't had any luck yet. This code will not allow special characters but it only allows the user to enter in two characters. The minimium length of my textbox is 15

jQuery(function ($) {
    $('#KnowledgebaseTitle').mask("a*"), { placeholder: " " };
});

解决方案

If you need 15 character length no special chars then:

jQuery(function ($) {
    $('#KnowledgebaseTitle').mask("***************"), { placeholder: " " };
});

'a' is for aphla chars.

If you need to make a custom mask filter then use:

$.mask.definitions['h'] = "[A-Fa-f0-9]"; // your regex filter etc...

I think this regex expression will work for windows special chars:

$.mask.definitions['h'] = "^[.\\\\/:*?\"<>|]?[\\\\/:*?\"<>|]*";

jQuery(function ($) {
    $('#KnowledgebaseTitle').mask("hhhhhhhhhhhhhhh"), { placeholder: " " };
});

这篇关于JQuery的蒙面输入 - 没有非法字符的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆