How to solve the problem that js implements the one-click copy function without preserving the format of the copied content?

if there is such a text in the picture, if you select it with the mouse and ctrl+c, paste it into the text box
clipboard.png
:
clipboard.png

copy:


js:

clipboard.png

how does js simulate how to achieve mouse selection and then ctrl+c copy and paste into the text box to retain the effect of line wrapping?

Sep.17,2021

you can create a textarea try, you can save the format

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ece2-2bc8d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ece2-2bc8d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?