1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.html or http://ckeditor.com/license
6 <html xmlns="http://www.w3.org/1999/xhtml">
8 <title>Ajax — CKEditor Sample</title>
9 <meta content="text/html; charset=utf-8" http-equiv="content-type" />
10 <script type="text/javascript" src="../ckeditor.js"></script>
11 <script src="sample.js" type="text/javascript"></script>
12 <link href="sample.css" rel="stylesheet" type="text/css" />
13 <script type="text/javascript">
16 var editor, html = '';
18 function createEditor()
24 // Create a new editor inside the <div id="editor">, setting its value to html
26 editor = CKEDITOR.appendTo( 'editor', config, html );
29 function removeEditor()
34 // Retrieve the editor contents. In an Ajax application, this data would be
35 // sent to the server or used in any other way.
36 document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData();
37 document.getElementById( 'contents' ).style.display = '';
39 // Destroy the editor.
49 CKEditor Sample — Create and Destroy Editor Instances for Ajax Applications
51 <div class="description">
53 This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
54 area will be displayed in a <code><div></code> element.
57 For details of how to create this setup check the source code of this sample page
58 for JavaScript code responsible for the creation and destruction of a CKEditor instance.
62 <!-- This <div> holds alert messages to be display in the sample page. -->
66 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
67 support, like yours, you should still see the contents (HTML data) and you should
68 be able to edit it normally, without a rich editor interface.
72 <p>Click the buttons to create and remove a CKEditor instance.</p>
74 <input onclick="createEditor();" type="button" value="Create Editor" />
75 <input onclick="removeEditor();" type="button" value="Remove Editor" />
77 <!-- This div will hold the editor. -->
80 <div id="contents" style="display: none">
83 <!-- This div will be used to display the editor contents. -->
84 <div id="editorcontents">
90 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
93 Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
94 Knabben. All rights reserved.