Expert Developer JavaScript Question: Download Questions PDF
How can the style/class of an element be changed?
![Expert JavaScript Developer Interview Answer Expert JavaScript Developer Interview Question](https://globalguideline.com/public/images/interview/22.png)
Answer:
It can be done in the following way:
JavaScript
document.getElementById("myText").style.fontSize = "20?;
or
document.getElementById("myText").className = "anyclass";
JavaScript
document.getElementById("myText").style.fontSize = "20?;
or
document.getElementById("myText").className = "anyclass";
Download Expert JavaScript Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
Write the code for adding new elements dynamically? | Explain how to detect the operating system on the client machine? |