How do I replace all line breaks in a string with
elements?

前端 未结 13 2284
刺人心
刺人心 2020-11-22 02:00

How can I read the line break from a value with JavaScript and replace all the line breaks with
elements?

Example:

A variable passe

相关标签:
13条回答
  • 2020-11-22 02:48

    if you send the variable from PHP, you can obtain it with this before sending:

    $string=nl2br($string);
    
    0 讨论(0)
提交回复
热议问题