JAVASCRIPT Questions and Answers

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

It can be done in the following way:

1

document.getElementById(“myText”).style.fontSize = “20?;

or

1

document.getElementById(“myText”).className = “anyclass”;