UEditor使用报错Cannot set property 'innerHTML' of undefined
来源:互联网 发布:华为mate7手机壳淘宝 编辑:程序博客网 时间:2024/05/06 05:50
仿用UEditor的setContent的时候报错,报错代码如下Uncaught TypeError: Cannot set property ‘innerHTML’ of undefined。调试ueditor.config.js,ueditor.all.js 提示me.body is undefined。(我就纳了闷儿了!同样的使用那个行这个咋就不行,那个有body,view,这个咋就这么少!【我还查看了插件的内部函数,真是个good媛~】)错误的原因是没有等UEditor创建完成就使用UEditor的setContent函数了,可以通过如下两种代码解决 :
ueditor.addListener("ready", function () {
ueditor.setContent('str');
});ueditor.ready(function() {
ueditor.setContent('str');
});
ps:
var ue = UE.getEditor('containerId'); var a = "<%= info.C_Introdution || '' %>"; a = escape2Html(a); $("#introdution").html(a); function escape2Html(str) { if(str.indexOf(""")){ str = str.replace(/"/ig,"""); } var arrEntities={'"':'"','lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'}; return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];}); } ue.ready(function() { ue.setContent(a); ue.addListener("contentchange", function () { $("#introdution").html(ue.getContent()); }) });
js转换html转义字符
2 0
- UEditor使用报错Cannot set property 'innerHTML' of undefined
- Ueditor Cannot set property 'innerHTML' of undefined
- UEditor使用及Cannot set property 'innerHTML' of undefined 及Cannot read property 'replace' of undefine
- UEditor的setContent的时候报错,报错代码如下 Uncaught TypeError: Cannot set property 'innerHTML' of undefined 错
- 使用UEditor的setContent的时候报错,报错代码如下 Uncaught TypeError: Cannot set property 'innerHTML' of undefined 错
- js报错 Cannot set property 'innerHTML' of null
- nodeJS(express-session中间件使用)报错: Cannot set property ' ' of undefined
- Cannot set property 'innerHTML' of null"
- TypeError: Cannot set property 'user' of undefined
- js Cannot set property 'color' of undefined
- Cannot set property 'value' of undefined
- JS: Cannot read property 'innerHTML' of undefined错误
- sencha touch报错 Cannot read property 'apply' of undefined
- 解决jquery报错cannot read property 'length' of undefined
- vue报错 vue Cannot read property ‘ob’ of undefined
- 解决dataTable 报错:cannot read property "style" of undefined
- Angularjs报错:TypeError: Cannot read property 'slice' of undefined
- react native 报错:cannot read property 'length' of undefined
- Android之MediaPlayer的简单介绍之播放音乐
- procyon 编译手册
- 高校图书馆知识管理策略剖析
- iOS 简易的实现类似QQ好友菜单
- ubuntu查看文件和文件夹大小
- UEditor使用报错Cannot set property 'innerHTML' of undefined
- Oracle普通表基于Rowid在线重定义表分区
- centos7.0安装后,配置LNMP
- android 5种存储数据方式
- MVP
- tcping
- 关于collections.sort()方法的应用
- java数组清除相同元素
- 归,寂