I am trying to change the CSS of one element on click of another element. I\'ve searched a lot but nothing works perfectly. Currently I am using the below code, but it doesn
Try this:
CSS
.style1{ background-color:red; color:white; font-size:44px; }
HTML
hello world!
Javascript
function myFunction() { document.getElementById('foo').setAttribute("class", "style1"); }