Skip to content

Instantly share code, notes, and snippets.

@zeshanshani
Created August 24, 2016 04:54
Show Gist options
  • Save zeshanshani/ae686e35d3788e5a3b91a6a26927b668 to your computer and use it in GitHub Desktop.
Save zeshanshani/ae686e35d3788e5a3b91a6a26927b668 to your computer and use it in GitHub Desktop.
Run a function multiple times until the element is found on the page
function runUACLCLoop() {
setTimeout(function() {
// Check if something is found on the page.
if ( jQuery('.class_name').is(':visible') ) { // change it to another condition
// Run the same function again to create the loop.
runUACLCLoop();
// If nothing is found, then run the else statement.
} else {
setTimeout(function () {
// Do other great stuff here....
}, 500);
}
}, 200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment