title: Setting CSS property - filter: blur(x) with JS for site-inner class within genesis framework; Cannot read property 'getAttribute' of null
body: <p>I'm trying to achieve blur effect with JS on "site-inner" class after the event of expanding the mobile dropdown menu in genesis sample theme by clicking the mobile menu button. </p>
  
  <p>The button has aria-expanded attribute and I decided to use it as a trigger.</p>
  
  <p>The HTML element that is being created by responsive-menus.js within Genesis Framework:</p>
  
  <pre><code>&lt;button class="menu-toggle dashicons-before dashicons-menu activated" aria-expanded="true" aria-pressed="true" id="genesis-mobile-nav-primary"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>Below is the code I'm using:</p>
  
  <pre><code>window.onload = blurFunction();
  
  function blurFunction() {
      var x = document.getElementById("genesis-mobile-nav-primary").getAttribute("aria-expanded"); 
      if (x == "true") 
      {
      document.getElementById("site-inner").style.webkitFilter = "blur(8px)";  
      }
  }
  </code></pre>
  
  <p>Console returns the following:</p>
  
  <pre><code>Uncaught TypeError: 
  Cannot read property 'getAttribute' of null.
  
  Uncaught TypeError: 
  Cannot set property 'webkitFilter' of undefined
  </code></pre>
  
  <p>EDIT: </p>
  
  <p>After removing the brackets function actually executes - but - I've added an else statement ant thats the only part that actually works. The function runs, checks the aria-expanded attribute and adds the else condition to the site-inner element to which I've added an id="st-pusher". </p>
  
  <p>Here's the code:</p>
  
  <pre><code>window.onload = blurFunction;
  
  function blurFunction() {
      let x = document.getElementById("genesis-mobile-nav-primary").getAttribute("aria-expanded");
  
      if (x == 'true') {
      document.getElementById("st-pusher").style.webkitFilter = "blur(8px)";  
      } else {
      document.getElementById("st-pusher").style.webkitFilter = "blur(0px)";  
      };
  }
  </code></pre>