0 votes
157 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 127 views
0 votes
1 answer 171 views
0 votes
1 answer 137 views
0 votes
1 answer 102 views
0 votes
1 answer 113 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

557 users

...