UEditor 使用 获取纯文本/格式纯文本/html内容

 

UEditor下载、文档、拓展

http://fex.baidu.com/ueditor/

http://fex.baidu.com/ueditor/#start-start

https://www.cnblogs.com/wsn1203/p/5443047.html

 

1. 下载ueditor 及 jquery,然后引用

2. html中创建内容元素

3. js初始化UEditor控件

<!DOCTYPE html>
<html lang="en">
<head>

</head> 
<body id="body">
<div>
    <span style="width:580px;height:100%;border:0px;">
        <script id="editor" type="text/plain" style="width:100%;height:500px;">
        </script>    
    </span>
</div>

<script src="/js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor-utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor-utf8-jsp/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/ueditor-utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	//实例化编辑器  去除不必要的编辑功能
	var ue = UE.getEditor('editor', {
	    toolbars: [
	        ['fullscreen']//只保留全屏功能
	    ],
	    enableContextMenu:false,//禁止使用右键菜单
	    elementPathEnabled:false,//不启用底部元素路径
	    maximumWords:100000, //允许的最大字符数
	    autoHeightEnabled:false,//禁止自动高度
	});
    //获取编辑器内容
    function editorContent(){
        alert(ue.getContent());//获取编辑器html内容
        alert(ue.getPlainTxt());//获取保留换行/空格等格式的纯文本
        alert(ue.getContentTxt());//获取纯文本内容
    }
</script>
</body>
</html>

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值