cjk-protector
v1.0.0
Published
Protect inputs/textareas from Chinese, Japanese and Korean characters
Downloads
3
Maintainers
Readme
cjkProtector jQuery plugin
Protect your inputs/textareas from Chinese, Japanese and Korean (CJK) characters.
Usage
<form>
<div>
<input type="text">
</div>
<div>
<textarea></textarea>
</div>
<input type="submit">
</form>
$(":input").cjkProtector();
Options
errorClass (string)
CSS class name added on input's wrapper div
element when CJK characters are found.
Default value is 'field_with_errors'
$(":input").cjkProtector({
errorClass: "cjk_error"
});
errorMessage (string)
Error message displayed when CJK characters are found.
Default value is 'Please use latin characters'
$(":input").cjkProtector({
errorMessage: "CJK characters found!"
});
onError (function)
Called when CJK characters are found.
Default value is empty
$(":input").cjkProtector({
onError: function() {
console.log("CJK characters found!")
}
});
onSuccess (function)
Called when CJK characters disappear.
Default value is empty
$(":input").cjkProtector({
onSuccess: function() {
console.log("Valid characters!")
}
});
Running specs
First, you have to install all the project dependencies:
$ npm install
and then execute:
$ grunt test
Compile plugin
Just execute:
$ grunt build
This will generate two versions of the plugin in the dist
folder.