Skip to content

Instantly share code, notes, and snippets.

@ogii
Last active February 5, 2019 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogii/1de2df1bacd9aab2824b0560dce21675 to your computer and use it in GitHub Desktop.
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
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