Copying text of textarea into div with line breaks

前端 未结 5 1967
春和景丽
春和景丽 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:26

    Use this line: Fiddle

    $('.'+contentAttr+'').html(value.replace(/\n/g,"
    "));

    The problem was that newlines don't create linebreaks in html, but
    will.

提交回复
热议问题