trouble with a javascript Cannot read property 'value' of
- by Stanislas Piotrowski
I've done a function but I do not understand why, a part of it does not work.
Actualy I use the methode using className and Id.
Here is the part of the code:
var items = new Array();
var itemCount = document.getElementsByClassName("items");
for(var i = 0; i < itemCount.length; i++)
{
items[i] = document.getElementById("p"+(i+1)).value;
}
return items;
}
And in jsfiddle the html part that show that this Id exist.
So it should not return to me this errors:
Uncaught TypeError: Cannot read property 'value' of null fiddle.jshell.net:402
the concerned line is the following:
items[i] = document.getElementById("p"+(i+1)).value;
http://jsfiddle.net/Wt4qd/
Kind Regards SP.