Answers for "make function wait until element exist in javascript"

1

jquery wait for target to load

//https://gist.github.com/chrisjhoughton/7890303

var waitForEl = function(selector, callback) {
  if (jQuery(selector).length) {
    callback();
  } else {
    setTimeout(function() {
      waitForEl(selector, callback);
    }, 100);
  }
};

waitForEl(selector, function() {
  // work the magic
});
Posted by: Guest on September-01-2020

Code answers related to "make function wait until element exist in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language