极其便捷的富文本wangEditor

转载地址    https://github.com/wangfupeng1988/wangEditor

用法在 docs/usage里面


    <div id="div1">
        <p>欢迎使用 <b>wangEditorb> 富文本编辑器p>
    div>
    <textarea id="text1" style="width:100%; height:200px;">textarea>

    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js">script>
    <script type="text/javascript" src="../wangEditor.js">script>
    <script type="text/javascript">
        var E = window.wangEditor
        var editor = new E('#div1')
        var $text1 = $('#text1')
        editor.customConfig.onchange = function (html) {
            // 监控变化,同步更新到 textarea
            $text1.val(html)
        }
        editor.create()
        // 初始化 textarea 的值
        $text1.val(editor.txt.html())
    script>

你可能感兴趣的:(web)