Last active
February 5, 2019 10:29
-
-
Save ogii/1de2df1bacd9aab2824b0560dce21675 to your computer and use it in GitHub Desktop.
Wait until an element exists on the page and then fire some code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function waitForElement() { | |
if (!document.querySelector("/* put element selector here */")) { | |
window.requestAnimationFrame(waitForElement); | |
} else { | |
/* put code to fire after element exists here */ | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment