title: How to get value of a div using javascript
body: <p>This is my div:</p>
  
  <pre><code>&lt;div id="demo" align="center"  value="1"&gt;
      &lt;h3&gt;By Color&lt;/h3&gt;
      &lt;input type="radio" name="group1" id="color1" value="#990000"  onClick="changeColor()"/&gt;&lt;label for="color1"&gt;Red&lt;/label&gt;
      &lt;input type="radio" name="group1" id="color2" value="#009900" onClick="changeColor()"/&gt;&lt;label for="color2"&gt;Green&lt;/label&gt;
      &lt;input type="radio" name="group1" id="color3" value="#FFFF00" onClick="changeColor()" /&gt;&lt;label for="color3"&gt;Yellow&lt;/label&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want the value attribute of that div (value="1"). </p>
  
  <p>I am trying like this:</p>
  
  <pre><code>function overlay()
  {
      var cookieValue = document.getElementById("demo").value;    
      alert(cookieValue);
  }
  </code></pre>
  
  <p>but it is showing "Undefined" how to get value 1 using javascript please suggest any solution,.</p>