It can be done in the following way:document.getElementById("myText").style.fontSize = "20";ordocument.getElementById("myText").className = "anyclass";