3 Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.md or http://ckeditor.com/license
9 <title>Ajax
— CKEditor Sample
</title>
10 <script src=
"../ckeditor.js"></script>
11 <link rel=
"stylesheet" href=
"sample.css">
14 var editor, html = '';
16 function createEditor() {
20 // Create a new editor inside the
<div id=
"editor">, setting its value to html
22 editor = CKEDITOR.appendTo( 'editor', config, html );
25 function removeEditor() {
29 // Retrieve the editor contents. In an Ajax application, this data would be
30 // sent to the server or used in any other way.
31 document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData();
32 document.getElementById( 'contents' ).style.display = '';
34 // Destroy the editor.
43 <a href=
"index.html">CKEditor Samples
</a> » Create and Destroy Editor Instances for Ajax Applications
45 <div class=
"description">
47 This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
48 area will be displayed in a
<code><div
></code> element.
51 For details of how to create this setup check the source code of this sample page
52 for JavaScript code responsible for the creation and destruction of a CKEditor instance.
55 <p>Click the buttons to create and remove a CKEditor instance.
</p>
57 <input onclick=
"createEditor();" type=
"button" value=
"Create Editor">
58 <input onclick=
"removeEditor();" type=
"button" value=
"Remove Editor">
60 <!-- This div will hold the editor. -->
63 <div id=
"contents" style=
"display: none">
67 <!-- This div will be used to display the editor contents. -->
68 <div id=
"editorcontents">
74 CKEditor - The text editor for the Internet -
<a class=
"samples" href=
"http://ckeditor.com/">http://ckeditor.com
</a>
77 Copyright
© 2003-
2014,
<a class=
"samples" href=
"http://cksource.com/">CKSource
</a> - Frederico
78 Knabben. All rights reserved.