JSFiddle - React, Tailwind, and code Playground

by Rupali Soni

HTML

<img src="http://fc01.deviantart.net/fs17/f/2007/129/7/4/Stock_032__by_enchanted_stock.jpg">

JavaScript

function main() {
jQuery(document).ready(function($) {
  var imgObj = $("img[src='http://fc01.deviantart.net/fs17/f/2007/129/7/4/Stock_032__by_enchanted_stock.jpg']")[0];
  var width;
  var height;
  var id = 47;
    console.log(imgObj);
  $("img") 
      .attr("src", $(img).attr("src"))
      .load(function() {
          width = this.width;   
          height = this.height; 
          console.log(width)
          var widgetReplace = "<iframe src=&quothttp://localhost:5000/app/#/widget" + id + "?height=" + height + "px&width=" + width + "px frameborder='0' height=&quot" + height + "&quot width=&quot" + width + "&quot style='overflow:'hidden';&quot></iframe>"; 
          this.replaceWith(widgetReplace);
      });        
   });
  }
})();