Copying text of textarea into div with line breaks

前端 未结 5 1966
春和景丽
春和景丽 2020-12-31 09:15

I am tying to make a simple effect using keyup() in jQuery. I just want that when user types into the textarea then the text which user types will

5条回答
  •  臣服心动
    2020-12-31 09:21

    Add a white-space: pre-wrap rule to the div's CSS.

    .mas {
        white-space: pre-wrap;
    }
    

    Demo: http://jsfiddle.net/Pqygp/13/

提交回复
热议问题