On Jul 10, 2007, at 1:06 PM, Klaus Hartl wrote:

Ok, say you want an array that gathers all the alt attributes of the matched elements, you can use the $.map method:

var altAttrs = $.map( $('img'), function() { return this.alt; } );


--Klaus


That's a good idea. Or, if you want to do stuff with the attribute, you could use an .each() method:

$('img').each(function() {
  var imgAlt = $(this).attr('alt');
  // do stuff
});


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




Reply via email to