JSFiddle - React, Tailwind, and code Playground

by Amandeep Singh

HTML

<figure>
   <a href="index.php/home.html">
      <img src="300x380.png" width="300" height="380" alt="">
   </a>
</figure>

JavaScript

var aTag = ($('figure').children('a')).clone();
var newTag = $(aTag).children('img').attr('src','otherimg.png');
$('figure').parent().append(newTag);
$('figure a img').unwrap('<a>');