Jump to content

evo99688

Member
  • Posts

    1
  • Joined

  • Last visited

Everything posted by evo99688

  1. Hello All, I am trying to run a footer script to delete some elements from a Calendar block. For some reason querySelectorAll('item.item--ongoing') seems to be firing before the page fully loads even though I am checking for 'complete' ready state. When I run querySelectorAll in the browser console it picks them up so it's a loading issue. Is there a way to wait longer for the script to run? <script > (function () { if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = Array.prototype.forEach; } document.addEventListener('readystatechange', event => { if (document.readyState === "complete") { init() } }); function init() { var monthlyEl = document.querySelectorAll('.item.item--ongoing'); console.log('item--ongoing',monthlyEl.length) new MutationObserver(function() { init(); // myFunction2(); , etc... }).observe(document.body, {attributes:true, attributeFilter:["class"]}); })(); </script>
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.