Answers

Question and Answer:

  Home  Expert JavaScript Developer

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

It can be done in the following way:

JavaScript

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

or

document.getElementById("myText").className = "anyclass";

 181 views

More Questions for you: