JSFiddle - React, Tailwind, and code Playground

HTML

<a id="gatb-1" before="1"  img="http://www.coolmath.com/fractals/images/fractal11.gif" class="glr">foo</a>

<img id="thmg" src="" />

CSS

img { border: 1px solid red; width: 100; height: 100px; display: block; }

JavaScript

var img = $("#gatb-1").attr('img');
$("#thmg").attr('src', img);

var b_type = "";

if ($("#gatb-1").attr('before')) {b_type = $("#gatb-1").attr('before');}
alert(b_type);