you could use the .each() method. I'm not sure from your post whether you want to get image height/set anchor height or get anchor height/ set image height. If you're trying to se the anchor height, you can do it like this:

$("#navi li img").each(function(index) {
  var $img = $(this);
  $img.parent('a').height( $img.height() );
});

The other way would go like this:

$("#navi li img").each(function(index) {
  var $img = $(this);
  $img.height( $img.parent('a').height() );
});



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




On Jul 6, 2008, at 4:26 PM, Samuel Vogel wrote:

Hey guys,

I have a list that contains images as anachors. I need to iterate over the items and apply the height of each image to the anachor that surround it (to fix a displaying problem in IE).
My code would look somehow like this:
$("#navi ul li a").attr("height", $("#navi ul li a img").attr("height"));

Of course this doesn't work, as the code needs to iterate over every list item seperately.
How would I achieve that?

Thanks for you help,
Samy

Reply via email to