How to break line in JavaScript?

后端 未结 4 1945
南笙
南笙 2020-11-27 21:37

Please let me know how to break line in JavaScript.



        
4条回答
  •  被撕碎了的回忆
    2020-11-27 22:20

    Add %0D%0A to any place you want to encode a line break on the URL.

    • %0D is a carriage return character
    • %0A is a line break character

    This is the new line sequence on windows machines, though not the same on linux and macs, should work in both.

    If you want a linebreak in actual javascript, use the \n escape sequence.


    onClick="parent.location='mailto:er.saurav123@gmail.com?subject=Thanks for writing to me &body=I will get back to you soon.%0D%0AThanks and Regards%0D%0ASaurav Kumar'
    

提交回复
热议问题