hi im trying to add a h2 with the title of an image after each image in my page... this is what ive got so far...
not really sure where im goin wrong
$("img[title]").each(function(){
this.after开发者_C百科("<h2>" . this.attr(title) "</h2>");
});
I think you're confusing JavaScript with php. Try:
$(this).after("<h2>" + $(this).attr('title') + "</h2>");
精彩评论