How To Change Style On An Element


  • 19 Jan, 2012

    Between CSS and JavaScript is a weird symmetry. CSS style rules are laid 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";

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 downloadmela.com. All rights reserved.