In the following string, I'm trying to add an additional span around the post.caption but keep it inside the <span class="overlay" />. I've tried prepend and wrap before and after the .html, but can't get it or anything to do it correctly.
$('<span class="overlay" />').html(post.caption).appendTo(entry);
Result would look like <span class="overlay"><span>Caption content</span></span>
Here's the full snippet if that helps:
entry = $('<a />').attr('href', post.permalinkFull)
$('<img />').attr('src', post.image).appendTo(entry)
$('<span class="overlay" />').html(post.caption).appendTo(entry);
Any help would be hugely appreciated!
post.caption?<span class="overlay"></span>?$('<span class="overlay" />')works fine as wellentryto the document?