Today, when I was working on a comment function similar to that of QQ, I was at a loss and looked for answers everywhere on the Internet. Finally, I was inspired in a very small corner. I got to know a new thing, contenteditable.
The html code is as follows:
js code:
Interface before operation:
Interface after clicking insert:
Enter text, and the inserted image can also be copied from one input box to another
Call it done.