zui框架kindeditor編輯器賦值與取值

1 引入js

<script src="../../Js/zui/lib/kindeditor/kindeditor-min.js"></script>

2 html

  <textarea rows="5" name='description' id='description'
     value='' class='form-control kindeditorSimple'></textarea>

3 js方法

//頁面初始化
var  editor = KindEditor.create('textarea.kindeditorSimple', {
        basePath: '../../Js/zui/lib/kindeditor/',
        bodyClass : 'article-content',     // 確保編輯器內的內容也應用 ZUI 排版樣式
        cssPath: '../../Js/zui/css/zui.css', // 確保編輯器內的內容也應用 ZUI 排版樣式
        resizeType : 1,
        allowPreviewEmoticons : false,
        allowImageUpload : false,
        items : [
            'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
            'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
            'insertunorderedlist', '|', 'emoticons','image', 'link'
        ]
    });


//取值
 var description = editor.html();
//賦值
editor.html(description );
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章