Fix tooltip.js

Adds a timeout to make sure everything is loaded before changing the DOM
This commit is contained in:
MollTheCoder 2023-07-13 20:56:40 -04:00 committed by GitHub
parent 214d093869
commit e2588d51af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 12 deletions

View File

@ -3,6 +3,7 @@ let tooltipEle;
window.addEventListener("load", ()=>{ window.addEventListener("load", ()=>{
tooltipEle = document.createElement("p"); tooltipEle = document.createElement("p");
tooltipEle.innerHTML = defaultTooltip; tooltipEle.innerHTML = defaultTooltip;
setTimeout(()=>{
document.getElementById("extraInfo").children[1].appendChild(tooltipEle); document.getElementById("extraInfo").children[1].appendChild(tooltipEle);
let buttons = document.getElementsByClassName("elementButton"); let buttons = document.getElementsByClassName("elementButton");
[...buttons].forEach(button=>{ [...buttons].forEach(button=>{
@ -19,3 +20,4 @@ window.addEventListener("load", ()=>{
}); });
}); });
}); });
});