UEditor使用报错Cannot set property 'innerHTML' of undefined
仿用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转义字符
转载于:https://www.cnblogs.com/Jeremy2001/p/7442076.html
UEditor使用报错Cannot set property 'innerHTML' of undefined相关推荐
- uEditor setContent方法报错Uncaught TypeError: Cannot read property ‘innerHTML‘ of undefined
uEditor setContent方法报错Uncaught TypeError: Cannot read property 'innerHTML' of undefined 报错信息 解决方法 报错 ...
- 记录webpack使用问题,使用报错“UnhandledPromiseRejectionWarning,file-loader图片过大,无法加载图片,打包html文件报错TypeError
记录webpack使用报错 版本号问题 运行npm run build,报错 "UnhandledPromiseRejectionWarning: TypeError: this.getRe ...
- git使用报错:fatal: Couldn't find remote ref master的解决方法
git使用报错:fatal: Couldn't find remote ref master的解决方法 fatal: Couldn't find remote ref master 翻译过来就是:致命 ...
- Assets.car 解压工具 cartool 使用报错 segmentation fault cartool 解决方案
Assets.car 解压工具 cartool 使用报错 segmentation fault cartool 解决方案 参考文章: (1)Assets.car 解压工具 cartool 使用报错 s ...
- “this”不能在常量表达式中使用报错的解决方法
"this"不能在常量表达式中使用报错的解决方法 问题描述与思考 在用C++书写下面一段代码时,编译器报错"'this'不能在常量表达式中使用".在这里,我最开 ...
- CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata
服务器上的yum突然不好使用,使用yum的时候报错如下: [root@bastion-IDC src]# yum list ...... Could not retrieve mirrorlist h ...
- Python安装xlrd和xlwt的步骤以及使用报错的解决方法
Python安装xlrd和xlwt的步骤以及使用报错的解决方法 参考文章: (1)Python安装xlrd和xlwt的步骤以及使用报错的解决方法 (2)https://www.cnblogs.com/ ...
- git使用报错: fatal: Couldn‘t find remote ref master的解决方法
git使用报错: fatal: Couldn't find remote ref master的解决方法 参考文章: (1)git使用报错: fatal: Couldn't find remote r ...
- cnpm使用报错-最佳方案
问题:cnpm使用报错throw err;^Error: Cannot find module 'fs/promises 现象: 解决方案: 查看你的cnpm的版本是不是高于8.2.0 cnpm 8. ...
最新文章
- hive(让我凌乱的一天)
- SVG与UML图详解
- 查询成绩(要求用链表完成)
- [转]svn常用命令
- P2146 [NOI2015] 软件包管理器
- Apollo进阶课程 ⑨ | 业界的高精地图产品
- 一家化纤工厂的数字化转型之路
- html5 innerhtml标签,innerHTML、outerHTML与innerText、outerText
- Tomcat 日志概述
- 山东理工大学SDUT - ACM OJ 题: Python代码 及分析
- win10安装atom的步骤
- 隧道技术_宏润建设隧道技术荣获教育部科技进步奖
- C语言 - 计算n的阶乘(n!)
- Android背景虚化的PopupWindow 可指定虚化区域
- Java实现——Dom4j读写XML文件
- 手机技巧:苹果手机这8个实用小技巧
- 904. 水果成篮(c++)
- 数据库之数据库和表的创建
- 2022年全国职业技能大赛网络安全竞赛试题B模块自己解析思路(2)
- 安卓大作业(AndroidStudio开发)日记记事本app