var myString = frm.categoria.value; myString = myString.replace(/\n/g,' '); var mySplitResult = myString.split(" ");