Ticket #10349: replacebycode2.html

File replacebycode2.html, 3.6 KB (added by Jakub Ś, 11 years ago)
Line 
1<!DOCTYPE html>
2<!--
3Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5-->
6<html>
7<head>
8        <title>Replace Textarea by Code &mdash; CKEditor Sample</title>
9        <meta charset="utf-8"> 
10        <script src="../ckeditor.js"></script>
11        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
12        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
13       
14        <link href="sample.css" rel="stylesheet">       
15</head>
16<body>
17        <h1 class="samples">
18                <a href="index.html">CKEditor Samples</a> &raquo; Replace Textarea Elements Using JavaScript Code
19        </h1>
20        <form method="post" class="validForm" action="actionURL" enctype="multipart/form-data">
21
22<select name="category" id="category" onChange="changeCategory()">
23<option value="rings" >Gyûrûk</option>
24<option value="earrings" >Fülbevalók</option>
25<option value="bracelets" >Karkötõk</option>
26<option value="necklance-medal">Nyaklánc / Medál</option>
27<option value="collections">Kollekció</option>';
28</select>
29
30<textarea class="editor" id="editor1" name="details"><p>ggg</p></textarea><br>
31
32<div id="category_panel"> // THIS PANEL IS HIDE IF COLLECTION NOT SELECTED
33<h2>2. item</h2>
34<input name="sku2" type="text" placeholder="SKU 2" class="required" value="1" />
35<textarea class="editor" id="editor2" name="details2"><p>ggg2</p></textarea><br>
36<h2>3. item</h2>
37<input name="sku3" type="text" placeholder="SKU 3" value="3" />
38<textarea class="editor" id="editor3" name="details3"><p>ggg3</p></textarea><br>
39<h2>4. item</h2>
40<input name="sku4" type="text" placeholder="SKU 4" value="4" />
41<textarea class="editor" id="editor4" name="details4"><p>ggg4</p></textarea><br><br>
42<h2>Collection details</h2>
43<textarea class="editor" id="editor5" name="details_collection"><p>ggg5</p></textarea><br>
44</div>
45
46<div class="submit"><input value="save" type="submit" /></div>
47</form>
48
49<script type="text/javascript"> 
50function changeCategory() {
51    var category = $('#category').val();
52        if (category=='collections'){
53                $('#category_panel').show('blind', {direction: 'horizontal'}, 3000 );
54        }
55        else{
56                $('#category_panel').hide('blind', {direction: 'horizontal'}, 3000 );
57        }
58}
59
60$(document).ready(function() {
61$('textarea.editor').each(function(){
62    CKEDITOR.replace( $(this).attr('id'), {
63        forcePasteAsPlainText : true,
64        enterMode : CKEDITOR.ENTER_BR,
65        shiftEnterMode : CKEDITOR.ENTER_P,
66                toolbar :
67                [
68            { name: 'document', items : [ 'Source'] },
69            { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
70            { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent'] },
71            { name: 'links', items : [ 'Link','Unlink' ] },
72            { name: 'insert', items : [ 'Table','SpecialChar' ] },
73            { name: 'styles', items : [ 'FontSize' ] },
74            { name: 'colors', items : [ 'TextColor' ] }
75                ]} );
76});
77$('#category_panel').hide('blind', {direction: 'horizontal'}, 3000 );
78var category = $('#category').val();
79if (category=='collections'){
80        $('#category_panel').show('blind', {direction: 'horizontal'}, 3000 ); // THIS IS THE WRONG LINE. REPLACED $('#category_panel').show();
81}
82});
83
84</script>
85
86        <div id="footer">
87                <hr>
88                <p>
89                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
90                </p>
91                <p id="copy">
92                        Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
93                        Knabben. All rights reserved.
94                </p>
95        </div>
96</body>
97</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy