I have several divs with the same class name, which have many elements I need values (e.g. numbers) from to check equality with another values, but my approach doesn't work.
First, I got a html collection of all divs I want. I converted the html collection to an array, so I can iterate through it.
var divCol = document.getElementsByClassName("test");
var arr = Array.prototype.slice.call( divCol );
for (var i = 0, len = arr.length; i < len; i++) {
var again=arr[i];
var pSize=again[i].getElementsByClassName("product_size").value;
alert (pSize);
[...]
}
To test what's stored in the paragraph "product_size" of the div at index i, I used an alert on pSize, but it says that pSize is undefined.