문제

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: " " };
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top