After obtaining the content wangEditor editor, submit the form and content editors get it

Hang ------------- hey, have to say, this editor is very beautiful, but. . . . . . . . .

I was doing so. . . . . . ,

1. First introduced his editor js

<script th:src="@{/static/assets/js/editorwang.js}"></script>
<script th:src="@{/static/assets/js/jquery.min.js}"></script>
</body>
<script type="text/javascript">
    var E = window.wangEditor
    var editor = new E('#editor')
    // 或者 var editor = new E( document.getElementById('editor') )
    editor.create()
    //设置文本内容

    editor.txt.html($('#noplay').text())
    $('#submitedit').click(function () {
        alert(editor.txt.html())
        $('#text1').text(editor.txt.html());
        alert($('#text1').text())
    })
</script>

2. This is what I wrote in a div, in fact, hidden div, then echoed back to the editor

<div class="am-form-group">
                                <label for="editor" class="am-u-sm-3 am-form-label">文章内容</label>
                                <div id="editor" placeholder="请输入文稿内容" class="am-u-sm-9">
                                </div>
                                <div style="display: none" name="newscontent">
                                    <textarea id="text1" style="width:100%; height:200px;" th:value="${selnews.newscontent}" name="newscontent"></textarea>
                                </div>
                                <div style="display: none" id="noplay">
                                    '这里面是你要回显的内容'
                                </div>
                            </div>

 

Published 37 original articles · won praise 12 · views 6465

Guess you like

Origin blog.csdn.net/weixin_38960774/article/details/104600965