How to read line by line of a text area HTML tag

后端 未结 5 1101
借酒劲吻你
借酒劲吻你 2020-11-29 21:10

I have a text area where each line contains Integer value like follows

      1234
      4321
     123445

I want to check if the user has re

5条回答
  •  悲&欢浪女
    2020-11-29 21:52

    This works without needing jQuery:

    var textArea = document.getElementById("my-text-area");
    var arrayOfLines = textArea.value.split("\n"); // arrayOfLines is array where every element is string of one line
    

提交回复
热议问题