Forum Moderators: open

Message Too Old, No Replies

problems with document.getElementByClassName

         

charlee

9:42 pm on Jun 4, 2008 (gmt 0)

10+ Year Member



Im trying this

document.getElementsByClassName('element').style.display = 'none'

and its not working, my js debugger sais that document.getElementByClassName('class').style has no properties, I was googling a little bit to find the reason why, and it seems that this DOM event returns an array of objects or something like that but I havent been able to figure out how to handle it so far.

thanks in advance.

daveVk

5:57 am on Jun 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you know there one and only one of this className try

document.getElementsByClassName('element')[0].style.display = 'none'