Search code examples
javascriptarraysend-of-line

Javascript: Convert textarea into an array


How would you go about breaking up a textarea value into an array, based on the end of line separation? Use of jQuery is cool by me...


Solution

  • This should work (tested in Firefox and Google Chrome):

    var arrayOfLines = $('#textAreaID').val().split('\n');