I have a textarea where the user can write up to 1000 characters. I need to get the jQuery(\'#textarea\').val() and create an array where each item
textarea
jQuery(\'#textarea\').val()
Try this
var lines = []; $.each($('textarea').val().split(/\n/), function(i, line){ if(line && line.length){ lines.push(line); } });