Retrieve alt text from main image to thumb image in blog post listing

40 Views Asked by At

My website (blog) is hosted by blogger and on the homepage it lists all of the posts with an thumb image and description, date etc. The image thumb of each listed post is the scaled down image in found at the top of each main post.

This is all okay, but the thumb image doesn't bring the alt text from the original post image and I wondered if anyone can help me so it does this.

I've found the code and I added an alt tag as you can see below. But the alt tag is the same for every thumb on the home page. Is there a way of it bringing the alt information from each original post image?

if(img.length >=1) {
    var imgurl=img[0].src;
    var thumb = '<div class="post-image"><a href="'+posturl+'"><img class="thumb" width="940" height="987" alt="image of review post" src="'+imgurl+'"></a></div>';
     var summary1 = thumb+'<div class="embedd"><header class="post-header"><div class="labelhome">'+tag+'</div><h2 class="entry-title"><a href='+ posturl +'>'+title+'</a></h2></header><div class="entry-content clear"><div class="intro-text">'+stripHtmlTags(content,30)+'... </div></div><div class="cen clearfix"><span class="post-da">'+date+'</span></div></div>';

Would someone be able to alter the code for me so it does what I want? I'm not a coder and just dabbling so please be kind. It would be great to copy and paste the new code in if possible.

Many thanks

0

There are 0 best solutions below