Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript inserting rel and title attr into anchor tags Re: inserting rel and title attr into anchor tags

#82792
wolfcry911
Participant

the .attr method will get the attribute from only the first element in the selection

there may be a better way, but I believe this works:

$('#gallery a').each(function(){
imgtitle = $(this).children('img').attr('title'),
$(this).attr('title',imgtitle);
});