• +91 9723535972
  • info@interviewmaterial.com

Java Script Interview Questions and Answers

Question - How to change style on an element?

Answer - Between CSS and javascript is a weird symmetry. CSS style rules are layed on top of the DOM. The CSS property names like "font-weight" are transliterated into "myElement.style.fontWeight". The class of an element can be swapped out. For example: document.getElementById("myText").style.color = "green"; document.getElementById("myText").style.fontSize = "20"; -or- document.getElementById("myText").className = "regular";  

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners