Skip to content

Instantly share code, notes, and snippets.

@jdvivar
Last active March 25, 2020 12:56
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 jdvivar/bd41756f78942a791ed68b2eeefd83ed to your computer and use it in GitHub Desktop.
Save jdvivar/bd41756f78942a791ed68b2eeefd83ed to your computer and use it in GitHub Desktop.
Wait for an element to appear, then when it does, do something with it
const interval = window.setInterval(() => {
// Search target element
const target = document.querySelector(...)
if (target) {
window.clearInterval(interval)
// Do something with target element
target.innerText = 'Meow'
}
}, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment