title: get attribute value with javascript in select list
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10369241/use-created-attribute-with-javascript-in-select-list">Use created attribute with javascript in select list</a>  </p>
  </blockquote>
  
  
  
  <p>im trying to access an attribute that i created in a select list.</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  function updateUrl()
      {
          var newUrl = document.getElementById('test').getAttribute('car');
          alert(newUrl);
      }
  &lt;/script&gt;
  
  &lt;select name= "test" id= "test" onChange= "updateUrl()"&gt;
       &lt;option value="1" selected="selected" car="red"&gt;1&lt;/option&gt; 
       &lt;option value="2" car="blue" &gt;2&lt;/option&gt; 
       &lt;option value="3" car="white" &gt;3&lt;/option&gt; 
       &lt;option value="4" car="black" &gt;4&lt;/option&gt;    
  &lt;/select&gt;
  </code></pre>
  
  <p>it keep giving me null. how do i get the value from attribute car?</p>