I want to take the innerhtml of a dynamically created div and put it in the clipboard but I keep getting a Type error. i want to access the .shortened div but I cant do it and I need help
const results = document.createElement('div')
// call api
function result(url){
fetch(https://api.shrtco.de/v2/shorten?url=${url})
.then(res => res.json())
.then(data =>{
if (data.ok){
var data= data
results.innerHTML = <div class="result">
<div class="sent">${data.result.original_link}</div>
<div class="shortened" id="short"><div>${data.result.short_link}</div>
<div class="copy-wrapper"></div><a href="#" class="copy" onClick= "copyLink()">Copy</a></div>
</div>
// create div
answer.appendChild(results)
}else {
alert('incorrect url')
}
mainBtn.innerHTML = "Shorten it!"
})
}