You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

9 lines
474 B

const el = document.getElementById("upload")
const placeholder = document.getElementById("upload-placeholder")
el.addEventListener("change", e => {
const file = e.target.files[0]
const url = URL.createObjectURL(file)
const html = `<div class="control" style="margin-right: 6px;"><div class="image is-128x128"><img class="is-rounded" src="${url}"></div></div>`
placeholder.innerHTML = html
placeholder.insertAdjacentHTML("afterend", "<div>---></div>")
})