title: Storing the style property's value into a variable, in JavaScript.
body: <p>I want to get the background property of my element. This is my code.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;style&gt;
  div#pt {
      background: rgba(192,15,18,1.00);
      width: 200px;
      height: 200px;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="pt" onClick="pick()"&gt;&lt;/div&gt;
  &lt;script&gt;
  function pick() {
  debugger;
  var color = document.getElementById("pt").style.background;
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I think this will work, but it doesn't work. It gives an empty string to <code>color</code> variable. I think this is not the right way to get the value of background's property. So, kindly help me, how can i get the value of background's property.</p>