I am using s3 library that directly uploads content from browser and returns the content inside a link tag. Now i want to display the url in link as an image. The current code i have working so far
var icon = document.getElementById("selectLogo");
icon.addEventListener("click",(evt)=> {
evt.preventDefault();
var element = document.getElementsByClassName("file-input")[0];
element.click();
});
var icon_link = document.getElementsByClassName("file-link")[0];
icon_link.addEventListener("onchange",(evt)=> {
evt.preventDefault();
console.log(icon_link);
});
where icon
my img
tag which triggers a click on upload
button. The problem i am facing is with icon_link
which is an link tag
. What i want is to listen for href
attribute change and update image accordingly . How can that be possible all using vanilla js and no external dependencies ?