I'm trying to create an array by accessing a class called 'name'. However, I'm only able to get the list of names in one block when I alert the array. I think I may be using the .each() wrong. I want to return an array that has the names listed separately. I would greatly appreciate any help!

jquery
$('.dropdown-content ul li span').click(function(){
$('.hiddenfield').val($(this).html());
$('form').submit(function(){
var arr=[];
$('.name').each( function()
arr.push(('.dropdown-content').val($(this).text()));
alert(arr);
})
});
});
submitnested insideclick?$inarr.push(('.dropdown-content')