i am creating div using DOM Element as
phototab = document.createElement('div');
phototab.setAttribute('class', 'phototab fleft');
//phototab.className = "phototab fleft";
i tried both methods but it is not adding class in IE7
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t use
setAttribute()to affect things that are actually properties of DOM elements.should work. (It’s an IE thing; other browsers are less picky, but for IE a property is a property and an attribute is an attribute.)
edit — I should say that you shouldn’t use
.setAttribute()when it’s unnecessary.