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