JSFiddle - React, Tailwind, and code Playground
HTML
<a href="" title="http://grokking.it/media/images/logo.jpg">Click me, boss!</a>
JavaScript
//$(document).ready(function() {
$("a").each(function() {
var $this = $(this);
$this.attr('href', $this.attr('title'));
});
$('a[href$=.jpg]').each(function() {
var imageSrc = $(this).attr('href');
var img = $('<img />').attr('src', imageSrc).css('max-width', '300px').css('max-height', '200px').css('marginBottom', '10px').css('marginTop', '10px').attr('rel', 'lightbox');
$('body').append(img);
$(this).replaceWith(img);
});
//});