Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js poll dom

function pollDOM () {
  const el = document.querySelector('my-element');

  if (el.length) {
    // Do something with el
  } else {
    setTimeout(pollDOM, 300); // try again in 300 milliseconds
  }
}

pollDOM();
Source by www.sitepoint.com #
 
PREVIOUS NEXT
Tagged: #js #poll #dom
ADD COMMENT
Topic
Name
4+1 =