문제

Simple question, I'm trying to output some text using javascript, and I want to have a new line between some of my text. The following code is what I'm using currently:

{
                text: '1/2 + 1/2',
                value: '[one_half]...[/one_half]\n[one_half]...[/one_half]',
                onclick: function() {
                    editor.insertContent(this.value());
                },

And this outputs

[one_half]...[/one_half] [one_half]...[/one_half]

how do I make it so my outputted text is:

[one_half]...[/one_half]
[one_half]...[/one_half]
도움이 되었습니까?

해결책

use <br/> instead of \n..

다른 팁

If it's ending in the web-browser (I don't know your special case) try using <br/> instead of \n

try escaping \n with single quotes and put the whole string into double quotes

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top