Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple jQuery snippet to set the title attribute of an <img> as a caption
$(document).ready(function() {
$("img").each(function () {
var $this = $(this);
var title = $this.attr("title");
$this.after('<div class="caption">'+ title +'</div>');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.