Split comma-separated input box values into array in jquery, and loop through it

The Solution to Split comma-separated input box values into array in jquery, and loop through it is


var array = $('#searchKeywords').val().split(",");

then

$.each(array,function(i){
   alert(array[i]);
});

OR

for (i=0;i<array.length;i++){
     alert(array[i]);
}

~ Answered on 2012-08-01 10:59:27


Most Viewed Questions: