JSFiddle - React, Tailwind, and code Playground

by insin

HTML

<script src="https://raw.github.com/insin/DOMBuilder/master/dist/DOMBuilder.dom.min.js"></script>
<input type="button" value="Add More" onclick="addMore()">

JavaScript

function createThing(href, src) {
  var el = DOMBuilder.elements
  return el.TD({valign: "bottom", width: "25%"}
  , el.A({href: href}
    , el.IMG({width: "150", height: "100", src: src, border:"0", alt:"Click", title:"Click"})
    )
  )
}

window.addMore = function() {
  document.body.appendChild(
    createThing("/images/00000.jpg", "http://farm4.static.flickr.com/3114/2524849923_1c191ef42e.jpg")
  )
}

// Print out an Array representation of the elements
DOMBuilder.withMode(null, function() {
  console.log(JSON.stringify(createThing("/images/00000.jpg", "http://farm4.static.flickr.com/3114/2524849923_1c191ef42e.jpg")))
})