dynamic-create-editormd.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>动态创建 Editor.md - 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>动态创建 Editor.md</h1>
  14. <p>Dynamic create Editor.md</p>
  15. <br/>
  16. <div class="btns" style="margin:0;">
  17. <button id="create-btn">动态创建一个 Editor.md</button>
  18. <button id="remove-btn">移除 Editor.md</button>
  19. </div>
  20. </header>
  21. </div>
  22. <script src="js/jquery.min.js"></script>
  23. <script type="text/javascript">
  24. var testEditormd;
  25. $(function() {
  26. $("#create-btn").click(function(){
  27. $.getScript("../editormd.js", function() {
  28. $("#layout").append("<div id=\"test-editormd\"></div>");
  29. testEditormd = editormd("test-editormd", {
  30. width: "90%",
  31. height: 640,
  32. markdown : "### 动态创建 Editor.md\r\n\r\nDynamic create Editor.md",
  33. path : '../lib/'
  34. });
  35. });
  36. });
  37. $("#remove-btn").click(function() {
  38. testEditormd.editor.remove();
  39. });
  40. });
  41. </script>
  42. </body>
  43. </html>