I have JavaScript function , I want to run this function when webpage is completely loaded, But it's not working. here is my code
window.onload = function() {
var btn = document.getElementsByClassName('title');
for (var i = 0; i < btn.length; i++) {
btn[i].insertAdjacentHTML('afterend', `
<div> <button class= "btn">
<img src="logo.png" height="20px" width="70px">
</button>
</div>
`);
}
}