jQuery has done it again with a very succinct function to iterate over the values of a set and perform an action for each one. The each function is easy to use and keeps your code from being cluttered with many for loops.
var allAlts = new Array();
$('img').each(function(){
allAlts.push(this.alt);
});
These few lines of code will get the alt attribute of every image tag in your document and store it in an array.