兼容性强却文件轻巧的文本框检测插件诞生了。
本插件是基于正则表达式进行文本框检测的,通用性十分强。
关键代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
$(document).ready(
function
() {
$(
"#message"
).inputNotes(
{
sexwarning: {
pattern: /(^|\s)关键字(\s|$)/ig,
type:
'warning'
,
text:
'Do not type "sex"!'
},
numbersnote: {
pattern: /[0-9]/,
type:
'note'
,
text:
'Do not type numbers!'
}
}
);
});
|