title: Copying style from querySelector
body: <p>I'm trying to copy a style from the <code>.current_page_item</code> to different elements.</p>
  
  <p>I am using WordPress and am not sure of another way to do this dynamically.</p>
  
  <p>Essentially, I am using one style to color the <code>.current_page_item</code> (which changes colors depending on which page), and that is modifying the header color, and the post and content background colors.</p>
  
  <p>The way I have thought up to do this is via JavaScript.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>window.onload = function() {
      var page_color = document.querySelector('li.current_page_item').style.backgroundColor;
  
      document.querySelector('div.blog-post p').style.backgroundColor = page_color;
      document.querySelector('h2.blog-post-title').style.backgroundColor = page_color;
  }
  </code></pre>
  
  <p>It doesn't seem to be reading the backgroundColor from <code>.current_page_item</code>, but I am able to set it if I use the same method.</p>
  
  <p>Here is the page: <a href="http://whatloop.com/wpTheme/" rel="nofollow noreferrer">http://whatloop.com/wpTheme/</a></p>
  
  <p>Thanks!</p>