简体   繁体   English

CK编辑器未显示在弹出JavaScript中

[英]Ck editor not show in popup javascript

i put code ckeditor in my website, but ck editor not showing in popup javascript, previously i try put ckeditor not using popup. 我将代码ckeditor放在我的网站中,但是ck编辑器未显示在弹出JavaScript中,以前我尝试将ckeditor放在不使用弹出窗口的地方。 This ck editor work. ck编辑器的工作。 but i put in javascript popt not working. 但我放入javascript popt无法正常工作。

This is my screenshoot using javascript popup 这是我使用javascript弹出窗口的截图 在此处输入图片说明

This is my screenshoot not using javascript popup 这是我不使用javascript弹出窗口的截图 在此处输入图片说明

This is my script 这是我的剧本

<script src="element/ckeditor/ckeditor.js"></script>
<script>
        //ADD News
function news_add()
    {
        var content = '<div id="dialog_confirm_add" title="Create News"> ';
                    content += '        <table width="100%"> ';
                    content += '        <tr >';
                    content += '            <td width="35%">Title</td>';
                    content += '            <td>:</td>';
                    content += '            <td width="65%"><input  style="width:100%" type="text" name="title" id="title" value=""  class="text ui-widget-content ui-corner-all" /></td>';
                    content += '        </tr>';
                    content += '        <tr>';
                    content += '            <td>Content</td>';
                    content += '            <td>:</td>';
                    content += '            <td><textarea  style="width:100%" name="content" id="content" value=""  class="ckeditor" /></textarea></td>';
                    content += '        </tr>';
                    content +='     </table>';
                    content +='</div>';
                    $('body').append(content);

        $('#dialog_confirm_add').dialog({
            resizable: true,
            width: 500,
            height: 200, 
            modal: true,
            close: function destroy_dialog() {
                $( this ).dialog( 'destroy' );

                var bd = document.getElementsByTagName('body')[0];
                var dlg = document.getElementById('dialog_confirm_add');
                bd.removeChild(dlg);
            },
            buttons: {
                'Save': function() {

                                var data=[];    
                                var data_site_grid="";
                                insert_data();
                            mydata=[];
                },
                Cancel: function() {
                    $( this ).dialog( 'close' );
                    mydata=[];

                }
            }
        });

    }
        </script>

To initialize the new textarea that you are inserting append the ckeditor script after the new elements: 要初始化您要插入的新文本区域,请在新元素之后附加ckeditor脚本:

var s=document.createElement('script');
s.type='text/javascript';
s.src='//cdn.ckeditor.com/4.4.7/standard/ckeditor.js';
$('body').append(s);

As long as the ckeditor.js is included on the page, this should rescan the page for the textarea element and change to the ckeditor. 只要页面上包含ckeditor.js,它就应该重新扫描页面上的textarea元素,然后更改为ckeditor。

http://jsfiddle.net/96d9102L/1/ http://jsfiddle.net/96d9102L/1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM