title: JS onpage/window load
body: <p>I want to run this script on pageload or after all the elements are loaded.</p>
  <h1>JavaScript</h1>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
      function backgroundload (){
            $(&quot;.portfolio-background-color&quot;)
                var color = /#[0-9\A-F]+/.exec($(this).html())[0];
                $(this).css('background', color)
        }
         window.onload = backgroundload;
  &lt;/script&gt;
  </code></pre>
  <p>i'm new to js please check if my code is okay and is it the correct way to load the js</p>