var str ='1,2,3'; var arr = str.split(","); var array1 =[]; var array2 =[]; for(i=0,l=arr.length;i<l;i++){ note = $('#t'+arr[i]).val(); type = $('#type'+arr[i]+' :selected').val() array1.push(note); array2.push(type); }