Js remove all classes from element

Do not access className from the style object, access it directly like

this.className

document.querySelector('button').onclick = function() {
  this.className="";
}
.myClass {

  color:red;
  
}

.second {

  color:green;
}
<button id="button" class="myClass second">click me</button>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)