Expert Developer JavaScript Question:

How can the style/class of an element be changed?

Expert JavaScript Developer Interview Question
Expert JavaScript Developer Interview Question

Answer:

It can be done in the following way:

JavaScript

document.getElementById("myText").style.fontSize = "20?;
or
document.getElementById("myText").className = "anyclass";


Previous QuestionNext Question
Write the code for adding new elements dynamically?Explain how to detect the operating system on the client machine?