Javascript CKEditor多个ID的一个实例';s

Javascript CKEditor多个ID的一个实例';s,javascript,jquery,ckeditor,Javascript,Jquery,Ckeditor,我可以为多个ID的CKeditor使用一个配置吗 我的页面中有此配置: var editor = CKEDITOR.replace('dsi3',{ toolbar : [ { name: 'basicstyles', items : [ 'Bold','Italic'] }, { name: 'paragraph', items : [ 'Bulleted

我可以为多个ID的CKeditor使用一个配置吗

我的页面中有此配置:

var editor = CKEDITOR.replace('dsi3',{  
            toolbar :
                [
                    { name: 'basicstyles', items : [ 'Bold','Italic'] },
                    { name: 'paragraph', items : [ 'BulletedList'] }

                ],
            width: "210px",
            height: "140px"
        });
但我必须一次又一次地通过不同的ID,相反,我想做这样的事情:

var editor = CKEDITOR.replace('dsi3, dsi4, dsi5, dsi6',{    
            toolbar :
                [
                    { name: 'basicstyles', items : [ 'Bold','Italic'] },
                    { name: 'paragraph', items : [ 'BulletedList'] }

                ],
            width: "210px",
            height: "140px"
        });

您可以为选项使用一个变量

var editor_config = {
    toolbar: [
        {name: 'basicstyles', items: ['Bold', 'Italic']},
        {name: 'paragraph', items: ['BulletedList']}
    ],
    width: "210px",
    height: "140px"
};

CKEDITOR.replace('dsi3', editor_config );
CKEDITOR.replace('dsi4', editor_config );
CKEDITOR.replace('dsi5', editor_config );
CKEDITOR.replace('dsi6', editor_config );
或者使用jQuery,匹配以“dsi”开头的所有ID:


您可以为选项使用一个变量

var editor_config = {
    toolbar: [
        {name: 'basicstyles', items: ['Bold', 'Italic']},
        {name: 'paragraph', items: ['BulletedList']}
    ],
    width: "210px",
    height: "140px"
};

CKEDITOR.replace('dsi3', editor_config );
CKEDITOR.replace('dsi4', editor_config );
CKEDITOR.replace('dsi5', editor_config );
CKEDITOR.replace('dsi6', editor_config );
或者使用jQuery,匹配以“dsi”开头的所有ID: