Skip to content

Instantly share code, notes, and snippets.

@bitsprint
Created June 10, 2019 07:53
Show Gist options
  • Save bitsprint/dca0f48d9fc325b8d3329ca5f4872066 to your computer and use it in GitHub Desktop.
Save bitsprint/dca0f48d9fc325b8d3329ca5f4872066 to your computer and use it in GitHub Desktop.
Wait for element to be available in DOM
function waitForElement(selector, time) {
if (document.querySelector(selector) !== null) {
alert("The element is displayed, you can put your code instead of this alert.")
return;
}
else {
setTimeout(function() {
waitForElementToDisplay(selector, time);
}, time);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment