Created
June 10, 2019 07:53
-
-
Save bitsprint/dca0f48d9fc325b8d3329ca5f4872066 to your computer and use it in GitHub Desktop.
Wait for element to be available in DOM
This file contains hidden or 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(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