var toBeHidden_letter = document.getElementsByClassName('doc_direction');
for(var i = 0; i < 10; i++) {
toBeHidden_letter[i].style.display = 'block';
alert('i = '+i);
}
I only have 2 alerts. why?
Edited : I have 10 elements of class = 'doc_direction' in my HTML.
getElementsByClassNameonly returns 2 elements, and so your loop will error out on the third iteration ...