1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | |
---|
4 | <head> |
---|
5 | <title>CKEditor .destroy() issue in IE</title> |
---|
6 | <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/smoothness/jquery-ui.css" /> |
---|
7 | <link href="style.css" rel="stylesheet" /> |
---|
8 | </head> |
---|
9 | |
---|
10 | <body> |
---|
11 | <h2>CKEDITOR .destroy() issue in all IE's!</h2> |
---|
12 | |
---|
13 | <form name="myForm"> |
---|
14 | <div id="dialog"> |
---|
15 | <div id="param1"> |
---|
16 | <h3>ckeditor</h3> |
---|
17 | <label> |
---|
18 | <textarea name="txtarea"></textarea> |
---|
19 | </label> |
---|
20 | </div> |
---|
21 | <div style="display: none;" id="param2"> |
---|
22 | <h3>input</h3> |
---|
23 | <label> |
---|
24 | <input/> |
---|
25 | </label> |
---|
26 | </div> |
---|
27 | <button id="prev">prev</button> |
---|
28 | <button id="next">next</button> |
---|
29 | </div> |
---|
30 | </form> |
---|
31 | |
---|
32 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.js" data-semver="1.8.3" data-require="jquery@1.8.3"></script> |
---|
33 | <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script> |
---|
34 | <script src="//cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script> |
---|
35 | <script> |
---|
36 | (function(){ |
---|
37 | // My IIFE |
---|
38 | |
---|
39 | $("#dialog").dialog({ |
---|
40 | height: 500, |
---|
41 | width: 700 |
---|
42 | }); |
---|
43 | |
---|
44 | CKEDITOR.replace("txtarea", { |
---|
45 | toolbar: [ |
---|
46 | ['Source'] |
---|
47 | ] |
---|
48 | }); |
---|
49 | |
---|
50 | $("#prev").on("click", function(){ |
---|
51 | // on step initialization |
---|
52 | CKEDITOR.replace("txtarea"); |
---|
53 | $("#param1").show(); |
---|
54 | $("#param2").hide(); |
---|
55 | }); |
---|
56 | |
---|
57 | $("#next").on("click", function(){ |
---|
58 | // and destruction, things go awry in IE 9, 10, 11 |
---|
59 | CKEDITOR.instances.txtarea.destroy(); |
---|
60 | $("#param1").hide(); |
---|
61 | $("#param2").show(); |
---|
62 | }); |
---|
63 | |
---|
64 | |
---|
65 | }()); |
---|
66 | </script> |
---|
67 | </body> |
---|
68 | |
---|
69 | </html> |
---|