3 Copyright (c) 2003-2016, 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="warning deprecated">
46 This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/saveajax.html">brand new version in CKEditor SDK</a>.
48 <div class="description">
50 This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
51 area will be displayed in a <code><div></code> element.
54 For details of how to create this setup check the source code of this sample page
55 for JavaScript code responsible for the creation and destruction of a CKEditor instance.
58 <p>Click the buttons to create and remove a CKEditor instance.</p>
60 <input onclick="createEditor();" type="button" value="Create Editor">
61 <input onclick="removeEditor();" type="button" value="Remove Editor">
63 <!-- This div will hold the editor. -->
66 <div id="contents" style="display: none">
70 <!-- This div will be used to display the editor contents. -->
71 <div id="editorcontents">
77 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
80 Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
81 Knabben. All rights reserved.