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?
you don't need to pass any regular expression there. this works just fine..
(function($) { $(document).ready(function() { $('#data').click(function(e) { e.preventDefault(); $.each($("#keywords").val().split("\n"), function(e, element) { alert(element); }); }); }); })(jQuery);