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;
In your fiddle, you have td element with id p7 missing and p8 two times. Is that only in your fiddle example or in your actual code as well? If it’s in your code too, then there is your problem.
You have to correct one of those id’s to p7.