Jquery对话框无法使用ckeditor手风琴

时间:2013-06-05 11:57:47

标签: javascript jquery ckeditor jquery-ui-accordion jquery-dialog

我在Jquery手风琴中使用ckeditor,我在ckeditor之后的每个手风琴都有一个按钮。

在点击保存按钮上,我正在检查ckeditor的内容,如果值为none,那么我想显示jquery的对话框,其中包含正确的错误消息。

但它给了我错误

Error: TypeError: $(...).dialog is not a function

我在手风琴中添加ckeditor的代码

   $("#question-container textarea").each(function(){
       CKEDITOR.replace(($(this).attr('id')), subjetive_config);
   });

我的代码在出错时调用dailog

var editor = CKEDITOR.instances[textarea_id];
if (editor) { editor.destroy(true); }

    $("#dialog").html("Answer can not be empty!");
    $("#dialog").attr('title', 'Error');
    $("#dialog").dialog({draggable: false,resizable: false,modal: true,buttons: { "Close": function() { 
                            $(this).dialog("destroy"); 
                        } 
                    } 
                });
} 

任何指针或建议都会很棒 谢谢

1 个答案:

答案 0 :(得分:0)

确保您已包含 jQuery 库文件。

在您的代码中,您在初始化对话框时错过了大括号。 这将对您有所帮助:

$("#dialog").dialog({
    draggable: false,
    resizable: false,
    modal: true,
    buttons: [
             {
             text: "Close",
             click: function() {
                $( this ).dialog( "destroy" );
             }
             }
             ]
});

另请查看Dialog Widget