|
1 <!DOCTYPE html> |
|
2 <!-- |
|
3 Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. |
|
4 For licensing, see LICENSE.md or http://ckeditor.com/license |
|
5 --> |
|
6 <html> |
|
7 <head> |
|
8 <meta charset="utf-8"> |
|
9 <title>Append To Page Element Using JavaScript Code — CKEditor Sample</title> |
|
10 <script src="../../ckeditor.js"></script> |
|
11 <link rel="stylesheet" href="sample.css"> |
|
12 </head> |
|
13 <body> |
|
14 <h1 class="samples"> |
|
15 <a href="index.html">CKEditor Samples</a> » Append To Page Element Using JavaScript Code |
|
16 </h1> |
|
17 <div class="warning deprecated"> |
|
18 This sample is not maintained anymore. Check out the <a href="http://sdk.ckeditor.com/">brand new samples in CKEditor SDK</a>. |
|
19 </div> |
|
20 <div id="section1"> |
|
21 <div class="description"> |
|
22 <p> |
|
23 The <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR-method-appendTo">CKEDITOR.appendTo()</a></code> method serves to to place editors inside existing DOM elements. Unlike <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR-method-replace">CKEDITOR.replace()</a></code>, |
|
24 a target container to be replaced is no longer necessary. A new editor |
|
25 instance is inserted directly wherever it is desired. |
|
26 </p> |
|
27 <pre class="samples">CKEDITOR.appendTo( '<em>container_id</em>', |
|
28 { /* Configuration options to be used. */ } |
|
29 'Editor content to be used.' |
|
30 );</pre> |
|
31 </div> |
|
32 <script> |
|
33 |
|
34 // This call can be placed at any point after the |
|
35 // DOM element to append CKEditor to or inside the <head><script> |
|
36 // in a window.onload event handler. |
|
37 |
|
38 // Append a CKEditor instance using the default configuration and the |
|
39 // provided content to the <div> element of ID "section1". |
|
40 CKEDITOR.appendTo( 'section1', |
|
41 null, |
|
42 '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>' |
|
43 ); |
|
44 |
|
45 </script> |
|
46 </div> |
|
47 <br> |
|
48 <div id="footer"> |
|
49 <hr> |
|
50 <p> |
|
51 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
|
52 </p> |
|
53 <p id="copy"> |
|
54 Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
|
55 Knabben. All rights reserved. |
|
56 </p> |
|
57 </div> |
|
58 </body> |
|
59 </html> |