hi,
I am trying to create image caption by getting the value from alt in each img tag. i manage to get the alt value from each img tag with each();.
and i use insertAfter() to insert the alt value after each image, but it turns out very strange, have a look from the link below,
http://lauthiamkok.net/tmp/jquery/jquery.image_caption/
it create a list of captions instead!
what have done wrong to make this image caption function?
this is the code i made so far,
Code:
$("#content img").each(function () {
var title = $(this).attr("alt");
$(document.body).append("<div class='caption'>"+ title +"</div>");
$(".caption").insertAfter("#content img");
});
});
many thanks if u have any idea.
thanks,
Lau