UpTest > Web Development > Javascript Test

Test: Javascript Test

Question 1: Prev Next Hide answers
Which of the following correctly sets a class for an element?
document.getElementById(elementId).className = "Someclass";
3 votes
document.getElementById(elementId).setAttribute("className", "Someclass");
1 votes
document.getElementById(elementId).class = "Someclass";
0 votes
document.getElementById(elementId).style = "Someclass";
1 votes
Please login to submit your answer.