Insert text or image in editable div

    <div id="editer" contenteditable="true" style="border: 1px solid #ccc; width: 400px;
        height: 200px">
        123456123456
    </div>
    <button onclick="InsertImage()">
        InsertImage</button>
    <script type="text/javascript" language="javascript">
        var editer = document.getElementById ('edit');
        function InsertImage() {
            ImagePath = window.prompt('Image URL:', '');
            edit.focus ();
            document.execCommand('InsertImage', false, ImagePath);
        }
    </script>
Editable div must add contentenditable as true

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324841354&siteId=291194637