<!DOCTYPE html>
<html>
<style>
.myStyle {
background-color: coral;
padding: 16px;
}
.newStyle {
background-color: lightblue;
font-size: 24px;
padding: 16px;
}
</style>
<body>
<h1>The DOMToken Object</h1>
<h2>The replace() Method</h2>
<button onclick="myFunction()">Replace</button>
<p>Click "Replace" to replace "myStyle".</p>
<div id="myDIV" class="myStyle">
<p>I am myDIV.</p>
</div>
<script>
function myFunction() {
const list = document.getElementById("myDIV").classList;
list.replace("myStyle", "newStyle");
}
</script>
</body>
</html>