<!DOCTYPE html>
<html>
<style>
.myStyle {
background-color: coral;
padding: 16px;
}
.anotherClass {
text-align: center;
font-size: 25px;
}
.thirdClass {
text-transform: uppercase;
}
</style>
<body>
<h1>The DOMToken Object</h1>
<h2>The contains() and remove() Methods</h2>
<p>Click "Remove" to remove "anotherClass", if "myDIV" has a"myStyle" class.</p>
<button onclick="myFunction()">Remove</button>
<div id="myDIV" class="myStyle anotherClass thirdClass">
<p>I am myDIV.</p>
</div>
<script>
function myFunction() {
const element = document.getElementById("myDIV");
if (element.classList.contains("myStyle")) {
element.classList.remove("anotherClass");
}
}
</script>
</body>
</html>