Ok, simple thing I’m overlooking here. The following javascript is returning the title variable outside the anchor tag rather than inside of it (as the code looks to be written to me).
I know I’m missing something obvious, like a method to return the variable as a string or something similar but I’m not sure what’s going on.
Help?
EDIT: My mistake, it’s “view site” which is being returned outside the <a> tag
// Convert logo img alt tags into div.caption 's
$(".imgs_wrap img").each(function(i, ele) {
var title = $(ele).attr('title');
var description = $(ele).attr('alt');
$(this).parent().prepend('<div class="caption popup"><p> ' +description + ' <a target="_blank" class="view_site" href="http://'+title+'" />View Site</a></div></p>');
});
You’re mistakenly using the self-closing tag syntax when rendering the
<a>:bad line:
change to: