I have an HTML textarea where the user inserts numeric serial numbers. These are either inline, separated by any character (including space), or in column coming from an excel file.
The serial codes can be 14 characters long if the first character is “1” otherwise they are always a length of 15 characters.
What I would like to achieve is a jquery function that reads the content of this textarea and generates upon submitting the form, an html table with each serial code in a new tr line of a table.
So far i tried to split codes submitted in column:
Input example:
12345678912345
12345678912346
12345678912345
223456789123455
623456789123457
$("#add_code").click(function(){
var code = $("#code").val();
for (line in code.split('\n')){
$("#codes_list").append('<tr><td>'+code[line]+'</td></tr>');
}
});
Thanks in advance!
So you just want to split on any non-numeric?