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

0

It can be done in the following way:
document.getElementById("myText").style.fontSize = "20";
or
document.getElementById("myText").className = "anyclass";

asked Apr 14, 2023 at 19:28
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.