JavaScript: Pętla przez wszystkie elementy zwrócone przez getElementsByTagName
Próbuję przejść przez wszystkie elementy, które zostały ponownie uruchomionegetElementsByTagName("input")
używając forEach. Jakieś pomysły, dlaczego to nie działa w FF, Chrome lub IE?
<html>
<head>
</head>
<body>
<input type="text" value="" />
<input type="text" value="" />
<script>
function ShowResults(value, index, ar) {
alert(index);
}
var input = document.getElementsByTagName("input");
alert(input.length);
input.forEach(ShowResults);
</script>
</body>
</html>