今天在使用UEditor的setContent的時候報錯,報錯代碼如下
TypeError: me.body is undefined 或 Uncaught TypeError: Cannot set property 'innerHTML' of undefined 錯誤的原因是沒有等UEditor創建完成就使用UEditor的setContent函數了,可以通過如下代碼解決 方法一:
ueditor.addListener("ready", function () { ueditor.setContent('UEditor報錯TypeError: me.body is undefined'); });
方法二:
ueditor.ready(function() { ueditor.setContent('UEditor報錯TypeError: me.body is undefined'); });