document.getElementById not working in IE

Posted by Alloi on Stack Overflow See other posts from Stack Overflow or by Alloi
Published on 2010-03-22T07:50:16Z Indexed on 2010/03/22 7:51 UTC
Read the original article Hit count: 372

Hi,

I am using the below js code in order to change the class when a link is clicked.

document.getElementById("gifts").setAttribute("class", "gkvSprite selected");

This is not working in IE but it does in FF and Chrome Then I changed the code to :

document.getElementById("gifts").setAttribute("className", "gkvSprite selected");

Then it worked in IE stopped working in FF and Chrome.

Could someone please help me out here?

Thanks in Advance
Alloi

© Stack Overflow or respective owner

Related posts about getelementbyid

Related posts about JavaScript