jquery wait for target to load

Solutions on MaxInterview for jquery wait for target to load by the best coders in the world

showing results for - "jquery wait for target to load"
Ross
22 May 2018
1
2//https://gist.github.com/chrisjhoughton/7890303
3
4var waitForEl = function(selector, callback) {
5  if (jQuery(selector).length) {
6    callback();
7  } else {
8    setTimeout(function() {
9      waitForEl(selector, callback);
10    }, 100);
11  }
12};
13
14waitForEl(selector, function() {
15  // work the magic
16});
17
18
19
20