0 votes
138 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 114 views
0 votes
1 answer 156 views
0 votes
1 answer 124 views
0 votes
1 answer 90 views
0 votes
1 answer 90 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

535 users

...