Paragraphs in javascript

前端 未结 3 1519
南笙
南笙 2021-01-24 03:50

Do you know if there is an easy way of counting paragraphs in a textarea using nothing but javascript?

Thanks,

3条回答
  •  死守一世寂寞
    2021-01-24 04:17

    You can improve Sean Viera answer by splitting on (\n *\n)/g instead of just \n\n then you have no issues with spaces between the paragraphs

提交回复
热议问题