onchange.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Onchange - Editor.md examples</title>
  6. <link rel="stylesheet" href="css/style.css" />
  7. <link rel="stylesheet" href="../css/editormd.css" />
  8. <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
  9. </head>
  10. <body>
  11. <div id="layout">
  12. <header>
  13. <h1>Onchange event</h1>
  14. <p>Plaese press F12, open the develop tools.</p>
  15. <p id="output"></p>
  16. </header>
  17. <div id="test-editormd">
  18. <textarea style="display:none;">#### Settings
  19. ```javascript
  20. {
  21. onchange : function() {
  22. console.log("onchange =>", this, this.id, this.settings, this.state);
  23. // ....
  24. }
  25. }
  26. ```
  27. </textarea>
  28. </div>
  29. </div>
  30. <script src="js/jquery.min.js"></script>
  31. <script src="../editormd.js"></script>
  32. <script type="text/javascript">
  33. var testEditor;
  34. $(function() {
  35. testEditor = editormd("test-editormd", {
  36. width : "90%",
  37. height : 720,
  38. path : '../lib/',
  39. onchange : function() {
  40. $("#output").html("onchange : this.id =>" + this.id + ", markdown =>" + this.getValue());
  41. console.log("onchange =>", this, this.id, this.settings, this.state);
  42. }
  43. });
  44. });
  45. </script>
  46. </body>
  47. </html>