| 1 | <html><head> |
|---|
| 2 | <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
|---|
| 3 | <title> CKEDITOR inline on dynamic created element </title> |
|---|
| 4 | |
|---|
| 5 | <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script> |
|---|
| 6 | <script src="./ckeditor_447_standard/ckeditor.js"></script> |
|---|
| 7 | <!-- <script src="./ckeditor_447_full/ckeditor.js"></script> --> |
|---|
| 8 | <style>.cke{visibility:hidden;}</style> |
|---|
| 9 | |
|---|
| 10 | <style type="text/css"> |
|---|
| 11 | .cke_editable { |
|---|
| 12 | outline: 1px solid red; |
|---|
| 13 | padding: 10px; |
|---|
| 14 | background: #eee; |
|---|
| 15 | } |
|---|
| 16 | </style> |
|---|
| 17 | |
|---|
| 18 | </head> |
|---|
| 19 | <body> |
|---|
| 20 | <button type="button" onclick="appendEditor()">Append the new editor</button> |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | <script type="text/javascript">//<![CDATA[ |
|---|
| 25 | |
|---|
| 26 | function appendEditor() { |
|---|
| 27 | // A dynamically created element. |
|---|
| 28 | var el = $( '<p contenteditable="true">I\'m editable!</p>' ); |
|---|
| 29 | |
|---|
| 30 | // Append the element to <body>. |
|---|
| 31 | $( 'body' ).append( el ); |
|---|
| 32 | |
|---|
| 33 | // CKEDITOR.inline accepts DOM element as parameter. |
|---|
| 34 | CKEDITOR.inline( el.get( 0 ) ); |
|---|
| 35 | } |
|---|
| 36 | //]]> |
|---|
| 37 | |
|---|
| 38 | </script> |
|---|
| 39 | </body></html> |
|---|
| 40 | |
|---|