Expert Developer JavaScript Question:
Download Job Interview Questions and Answers PDF
How can the style/class of an element be changed?
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? |