Maestro Vladimir
Maestro Vladimir

Reputation: 1196

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. This ck editor work. but i put in javascript popt not working.

This is my screenshoot using javascript popup enter image description here

This is my screenshoot not using javascript popup enter image description here

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>

Upvotes: 0

Views: 1425

Answers (1)

Liquidchrome
Liquidchrome

Reputation: 904

To initialize the new textarea that you are inserting append the ckeditor script after the new elements:

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.

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

Upvotes: 2

Related Questions