In this article, we remove the CSS class using javascript. We create a simple text with some CSS and create a button. After clicking on the button call a javascript function and remove the class using javascript.

HTML
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="myDIV" class="mystyle"> Text with CSS</div> <br>
<button onclick="myFunction()">Remove Class</button>
</body>
</html>
CSS
.mystyle {
width: 50%;
padding: 25px;
background-color: red;
color: white;
font-size: 25px;
box-sizing: border-box;
}
Javascript
function myFunction() {
var element = document.getElementById("myDIV");
element.classList.remove("mystyle");
}
I hope this code will helpful for you.

Brijpal Sharma is a web developer with a passion for writing tech tutorials. Learn JavaScript and other web development technology.