In contenteditable div, linebreak ignored when enter key is pressed

后端 未结 2 443
醉话见心
醉话见心 2021-01-29 09:07

When I press the return key to start a new line for the post, the result auto-ignore the return key. I wondered what the most common way of making the output actually starts wi

2条回答
  •  隐瞒了意图╮
    2021-01-29 09:38

    No. The
    is not at all present there. There's \r\n. So you need to use:

    $comment = nl2br($comment);
    

    To convert all the new lines to break in your PHP code.

提交回复
热议问题