使用UEditor 报错Cannot read property 'nodeType' of undefined 解决办法

报如下错误

解决办法:

//对编辑器的操作最好在编辑器ready之后再做
ue.ready(function() {
})
<!-- 实例化编辑器 -->
<script type="text/javascript">
$(function(){
     var ue = UE.getEditor("container",{
                autoHeight: false
     });
     /对编辑器的操作最好在编辑器ready之后再做
     ue.ready(function() {
         //设置编辑器的内容
         ue.setContent('hello');
         //获取html内容,返回: <p>hello</p>
         var html = ue.getContent();
         alert(html)
         //获取纯文本内容,返回: hello
         var txt = ue.getContentTxt();
         alert(txt);
    });
});
</script>

猜你喜欢

转载自www.cnblogs.com/linhuaming/p/11966247.html