title: JavaScript body.style.background not working with linear-gradient in script.js but works fine in console
body: <p>body.style.background = not working in script.js included file everything else works the cashed dom selectors work typing the body.style.background = 'red'; works but not in included file</p>
  
  <p>I've tried console.logs as described in code below the output peculiar thing is 
  if i copy the logs from the callbacks and paste it with body.style.background it works but not in the script file.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>color_1 = document.querySelector("#color-1");
  color_2 = document.querySelector("#color-2");
  body = document.querySelector("body");
  
  function changeBackgroundColor() {
      body.style.background = "linear-gradient(to right, "+color_1.value+ ", "+ color_2.value+");";
  
  //************* I am getting the console.logs but the background's not changing
  
      console.log("linear-gradient(to right, " + color_1.value + ", " + color_2.value + ");");
  }
  
  //************* Both the listeners work fine and the cashed selectors
  
  color_1.addEventListener("input", changeBackgroundColor);
  color_2.addEventListener("input", changeBackgroundColor);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;Background Color Generator&lt;/title&gt;
  
        &lt;!-- Custom Styles --&gt;
        &lt;style type="text/css"&gt;
            body {
                    background: linear-gradient(to right, red , yellow);
            }
        &lt;/style&gt;
  
    &lt;/head&gt;
  
    &lt;body&gt;
        &lt;div class="container"&gt;
            &lt;input id="color-1" type="color"&gt;
            &lt;input id="color-2" type="color"&gt;
        &lt;/div&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Background should change color when color input is changed but nothing happens.</p>