向页面添加富文本编辑器

首先添加一个textarea:

1 <tbody id="tab_3" style="display: none">
2                 <tr>
3                     <td >
4                         <textarea rows="20" cols="180" id="productdesc" name="description"></textarea>
5                     </td>
6                 </tr>
7             </tbody>

添加js代码:

 1 if(ref == '#tab_3'){
 2                 // 编辑器参数
 3                  var kingEditorParams = {
 4                     //指定上传文件参数名称
 5                     filePostName  : "uploadFile",
 6                     //指定上传文件请求的url。
 7                     uploadJson : '/upload/uploadFck.do',
 8                     //上传类型,分别为image、flash、media、file
 9                     dir : "image"//,
10 //                     width : '1000px',
11 //                     height : '400px'
12                 }; 
13                 KindEditor.create('#productdesc',kingEditorParams);
14                 KindEditor.sync();
15             }

库的引用:

原文地址:https://www.cnblogs.com/cuibin/p/6936762.html