It seems straight forward but I still need some advice. I have this so far just to see if I can split the array twice...but it is not working
$(document).ready(function() { $("#GetData").click(function() { var string = $('#PartNum').val().replace(/(\r\n)/g, "~"); var group = string.split('~'); $.each(group, function() { var values = group.split(' '); alert(values); }); }); }); On Oct 6, 8:34 pm, James <james.gp....@gmail.com> wrote: > It should be fairly straightforward. > Get the content of the text field: $("PartNum").val(); > Use the split() function to split each line by "\n" (return). > Then for each of those lines, split it again by " " (space). > (Store all of these in an array(s).) > Then you can use the join() function to add "," (comma) to a list in > your array. > > On Oct 6, 1:32 pm, "robert...@gmail.com" <robert...@gmail.com> wrote: > > > > > I really hope someone can assist: > > > I am trying to take a form field: > > <textarea name="PartNum" cols="15" rows="5" id="PartNum" value=""></ > > textarea> > > > The user will put in part numbers , space, qty, carraige return ,then > > another entry on the next line....it will look like this: > > > bd1111 2 > > bd1200 5 > > > I want to split this into two querystring variables before submitting > > to next page: > > > mypage.asp?Partnum=bd1111,bd1200&Qty=2,5 > > > I have looked at the serialize() and array functions , but I can't > > figure it out. > > > thanks very much- Hide quoted text - > > - Show quoted text -