java1234开源博客系统
博客信息

范德萨2

0
发布时间:『 2024-10-12 15:39』  博客类别:人生感叹  阅读(186) 评论(13)

$.document.ready(function()

{

  UE.getEditor('editor').setContent('欢迎光临');

})

setContent方法无法加载内容,提示编辑器为空,后来想想,可能是编辑器还没有加载完就执行此脚本导致的。后在网上找资料,可以判断ueditor编辑器完成加载后再加载内容:

核心内容如下

var editor_a = new baidu.editor.ui.Editor(editorOption);
    editor_a.render('myEditor');
    editor_a.ready(function() {
        editor_a.setContent($('#content').val());
    });

 

具体例子:

$(document).ready(function () {
    // 自定义的编辑器配置项,此处定义的配置项将覆盖editor_config.js中的同名配置
    var editorOption = {
        //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
        toolbars: [['FullScreen', 'Source', 'Undo', 'Redo', 'Bold', 'forecolor', 'link', 'highlightcode']],
        //focus时自动清空初始化时的内容
        autoClearinitialContent: true,
         //关闭elementPath
         elementPathEnabled: false
    };
    var editor_a = new baidu.editor.ui.Editor(editorOption);
    editor_a.render('myEditor');
    editor_a.ready(function() {
        editor_a.setContent($('#content').val());  //赋值给UEditor
    });
    $('#title').val(title); //title赋值
});


关键字:   无

上一篇:没有了

下一篇:正则表达式学习一

评论信息 显示所有评论
1楼    0:0:0:0:0:0:0:1:3232      [ 2016-02-06 09:06 ]
2楼    0:0:0:0:0:0:0:1:fda      [ 2016-02-06 09:06 ]
3楼    0:0:0:0:0:0:0:1:fda      [ 2016-02-06 09:05 ]
4楼    0:0:0:0:0:0:0:1:fda      [ 2016-02-06 09:05 ]
5楼    0:0:0:0:0:0:0:1:dasdada      [ 2016-02-04 10:44 ]
6楼    0:0:0:0:0:0:0:1:dassssssssssss      [ 2016-02-04 10:44 ]
7楼    0:0:0:0:0:0:0:1:fdas      [ 2016-02-04 10:05 ]
8楼    0:0:0:0:0:0:0:1:alert('1')      [ 2016-02-02 21:07 ]
9楼    0:0:0:0:0:0:0:1:fda      [ 2016-02-02 15:54 ]
10楼    2.3.3.3:测试2      [ 2016-01-11 11:20 ]
11楼    1.1.1.1:测试      [ 2016-01-05 11:18 ]
发表评论
验证码: 
博主信息
Java1234_小锋
(知识改变命运,技术改变世界)
Powered by Java1234 V1.0 Copyright © 2012-2016 Java知识分享网 版权所有