A Pen by Krzysztof

Thumbnail
This awesome code was written by krte85, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright krte85 ©
  • HTML
  • CSS
  • JavaScript
    <h1 id="hhh">Witam</h1>

<button id="b1" onclick="myFunction();">ok</button>

/*Downloaded from https://www.codeseek.co/krte85/a-pen-by-krzysztof-kkbyLy */
    h1{
  text-align:center;
}

.klasa{
  
 color:blue;
}

.klasa2{
  
  color: red;
}


/*Downloaded from https://www.codeseek.co/krte85/a-pen-by-krzysztof-kkbyLy */
    function myFunction(){
  
  var x = document.getElementById('hhh');
  
//  x.className.replace("klasa","");
  x.className = "klasa2";
  alert(x.className);
}

Comments