0 votes
139 views
in Javascript by (98.9k points)
edited
How can the style/class of an element be changed?

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer

It can be done in the following way:

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

or

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

Related questions

0 votes
1 answer 115 views
0 votes
1 answer 157 views
0 votes
1 answer 126 views
0 votes
1 answer 92 views
0 votes
1 answer 93 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

537 users

...