X
X
xidios2020-09-25 21:58:52
JavaScript
xidios, 2020-09-25 21:58:52

How can I insert a long text with a large number of lines into the field I need?

I’m making a script in Tampermonkey

5f6e3db890c5f601387304.png
, here’s the code in hz, you need to insert a very long text with line breaks
5f6e3d83a7d8c711157271.png
and, accordingly, the text that I insert was displayed like this:
5f6e3d999eb38199612797.png

I know that the implementation in Figure 2 is incorrect, it’s just for clarity.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2020-09-25
@xidios

Enclose your piece of text in back quotes instead of double quotes :

`text
text
text`

If this is output in a <textarea> then the line breaks will show up as they should. If not, then you will either have to wrap the output in <pre>, or arrange <br> in the text using replace.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question