How can I reliably set the class attr w/JavaScript on IE, FF, Chrome, etc.?
        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
            8:11 UTC
        
        
        Read the original article
        Hit count: 337
        
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