I am able to get the elements with the specific class name, but unable to retrive the length of the amount of elements with that specific class name.
How should I go about getting the number of elements with the specific class name of a child element?
document.getElementById('contact').onsubmit = function() {
var children = this.children;
for(var i = 0; i < children.length; i++) {
if (children[i].className == 'req') {
console.log(children[i]); //defined
console.log(children[i].length); //undefined
}
}
return false;
};