mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-01 21:42:28 +02:00
Add jQuery validation example to the documentation
This commit is contained in:
parent
5f3a67dae2
commit
d9d7396612
18
README.md
18
README.md
|
@ -251,6 +251,24 @@ simplemde.isSideBySideActive(); // returns boolean
|
|||
simplemde.isFullscreenActive(); // returns boolean
|
||||
simplemde.clearAutosavedValue(); // no returned value
|
||||
```
|
||||
## jQuery validation
|
||||
To mimic the jQuery validation on the editor, you can use the following code.
|
||||
|
||||
```js
|
||||
editor.codemirror.on("change", function() {
|
||||
var element = $(editor.element);
|
||||
$(element).val(editor.value());
|
||||
$(element).trigger('keyup');
|
||||
});
|
||||
|
||||
editor.codemirror.on("focus", function() {
|
||||
$(editor.element).trigger('focus');
|
||||
});
|
||||
|
||||
editor.codemirror.on("blur", function() {
|
||||
$(editor.element).trigger('blur');
|
||||
});
|
||||
```
|
||||
|
||||
## How it works
|
||||
SimpleMDE is an improvement of [lepture's Editor project](https://github.com/lepture/editor) and includes a great many number of changes. It is bundled with [CodeMirror](https://github.com/codemirror/codemirror) and depends on [Font Awesome](http://fortawesome.github.io/Font-Awesome/).
|
||||
|
|
Loading…
Reference in a new issue