Which of the following would not set a class on a DOM element?A: element.class = ‘foobar’B: element.className = ‘foobar’C: element.classList.add(‘foobar’)D: element.setAttribute(‘class’, ‘foobar’) code example
Example: javascript setattribute
element.setAttribute(<name>, <value>);
// ex
var aElement = document.querySelector("a");
aElement.setAttribute("href", "https://isitchristmas.com/");
// same as <a href="https://isitchristmas.com/"></a>