特定のクラス名を持つ要素を取得できますが、その特定のクラス名を持つ要素の量の長さを取得できません。
子要素の特定のクラス名を持つ要素の数を取得するにはどうすればよいですか?
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;
};