Skip to content

Instantly share code, notes, and snippets.

View Carve's full-sized avatar
🏠
Working from home

CJ Ratliff Carve

🏠
Working from home
View GitHub Profile
@Carve
Carve / jquery.waitForEl.js
Created March 16, 2023 18:09
jQuery wait for element
var waitForEl = function (selector, callback, maxTimes = false) {
if (jQuery(selector).length) {
callback();
} else {
if (maxTimes === false || maxTimes > 0) {
maxTimes != false && maxTimes--;
setTimeout(function () {
waitForEl(selector, callback, maxTimes);
}, 100);
}