120
rated 0 times
[
121]
[
1]
/ answers: 1 / hits: 22561
/ 12 Years ago, sun, april 29, 2012, 12:00:00
Possible Duplicate:
Use created attribute with javascript in select list
im trying to access an attribute that i created in a select list.
<script language=JavaScript>
function updateUrl()
{
var newUrl = document.getElementById('test').getAttribute('car');
alert(newUrl);
}
</script>
<select name= test id= test onChange= updateUrl()>
<option value=1 selected=selected car=red>1</option>
<option value=2 car=blue >2</option>
<option value=3 car=white >3</option>
<option value=4 car=black >4</option>
</select>
it keep giving me null. how do i get the value from attribute car?
More From » javascript