0 votes
167 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 138 views
0 votes
1 answer 179 views
0 votes
1 answer 145 views
0 votes
1 answer 110 views
0 votes
1 answer 121 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

561 users

...