Javascript how to split newline

后端 未结 12 1969
一整个雨季
一整个雨季 2020-11-28 06:48

I\'m using jquery, and I have a textarea. When I submit by my button I will alert each text separated by newline. How to split my text when there is a newline?



        
12条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 07:34

    It should be

    yadayada.val.split(/\n/)
    

    you're passing in a literal string to the split command, not a regex.

提交回复
热议问题