本文轉載來自: UEditor報錯TypeError: me.body is undefinedjavascript
今天在使用UEditor的setContent的時候報錯,報錯代碼以下 TypeError: me.body is undefined 或 Uncaught TypeError: Cannot set property 'innerHTML' of undefined 錯誤的緣由是沒有等UEditor建立完成就使用UEditor的setContent函數了,能夠經過以下代碼解決 方法一:html
ueditor.addListener("ready", function () { ueditor.setContent('UEditor報錯TypeError: me.body is undefined'); });
方法二:java
ueditor.ready(function() { ueditor.setContent('UEditor報錯TypeError: me.body is undefined'); });