# 設置內容
> 【注意】wangEditor3 已停止維護,請使用 wangEditor 最新版本,具體查看[官網]((http://www.wangeditor.com/) )。
以下方式中,如果條件允許,盡量使用第一種方式,效率最高。
## html 初始化內容
直接將內容寫到要創建編輯器的`<div>`標簽中
```html
<div id="div1">
<p>初始化的內容</p>
<p>初始化的內容</p>
</div>
<script type="text/javascript" src="/wangEditor.min.js"></script>
<script type="text/javascript">
var E = window.wangEditor
var editor = new E('#div1')
editor.create()
</script>
```
## js 設置內容
創建編輯器之后,使用`editor.txt.html(...)`設置編輯器內容
```html
<div id="div1">
</div>
<script type="text/javascript" src="/wangEditor.min.js"></script>
<script type="text/javascript">
var E = window.wangEditor
var editor = new E('#div1')
editor.create()
editor.txt.html('<p>用 JS 設置的內容</p>')
</script>
```
## 追加內容
創建編輯器之后,可使用`editor.txt.append('<p>追加的內容</p>')`繼續追加內容。
## 清空內容
可使用`editor.txt.clear()`清空編輯器內容
- 介紹
- 開始使用
- 創建一個編輯器
- 使用JS模塊定義
- 菜單和編輯區域分離
- 單頁面多個編輯器
- 禁用編輯器
- 內容處理
- 設置內容
- 獲取內容
- 使用textarea
- 獲取JSON
- 參數配置
- 配置菜單
- debug模式
- onchange
- 配置編輯區域z-index
- 多語言
- 粘貼文本
- 插入網絡圖片回調
- 插入鏈接的校驗
- 插入網絡圖片的校驗
- onfocus
- onblur
- 配置顏色
- 配置表情
- 配置字體
- 上傳圖片
- tab顯示和隱藏
- base64格式保存圖片
- 上傳圖片到服務器
- 上傳到七牛云存儲
- 其他
- 全屏-預覽-查看源碼
- 上傳附件
- 關于markdown
- xss攻擊
- 用于React
- 用于Vue
- 用于angular
- 常用API