Skip to content

Instantly share code, notes, and snippets.

@ReenaVerma
Last active May 1, 2022 19:31
Show Gist options
  • Save ReenaVerma/04526929d036d414498f8fd270ae585a to your computer and use it in GitHub Desktop.
Save ReenaVerma/04526929d036d414498f8fd270ae585a to your computer and use it in GitHub Desktop.
const waitForElement = (className, callBack) => {
window.setTimeout(function(){
const element = document.querySelector(className);
if(element) {
callBack(className, element);
console.log("Element exists...");
} else {
waitForElement(className, callBack);
console.log("Wait for element...");
};
}, 1000);
};
waitForElement(".fare-card-outer-wrapper",function(){
console.log("Write logic here...");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment