Assuming element with id ‘id2’ is a textarea with the following entries:
a@123.com, b@123.com, c@123.com
When I run this, I am getting values 0, 1 and 2 – why?
jQuery('#myid').submit(function() {
var temp = jQuery('#id2').serializeArray();
var email_arr = temp[0].value.split(',');
for (e in email_arr)
alert(e);
return false;
});
Because
for ... initerates keys, not values, so usealert(email_arr[e])instead.