JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" class="imageURL1">
<button onclick="func()">Load image</button>
<div class="ImageContainer">
    <img src="" id="imgContainer"/>
</div>

JavaScript

var func = function(){
 var url = document.getElementsByClassName("imageURL1")[0].value
 alert(url)
 document.getElementById('imgContainer').setAttribute('src',url)
}