<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.mystyle {
width: 100%;
padding: 25px;
background-color: coral;
color: white;
font-size: 25px;
box-sizing: border-box;
margin-top: 15px;
}
.newone {
width: 50px;
padding: 10px;
background-color: green;
color: white;
margin-top: 15px;
}
</style>
</head>
<body>
<p>Click the "Try it" button to change the class of the DIV element from "mystyle" to "newone":</p>
<button onclick="myFunction()">Try it</button>
<div id="myDIV" class="mystyle">
This is a DIV element.
</div>
<script>
function myFunction() {
const element = document.getElementById("myDIV");
element.classList.remove("mystyle");
element.classList.add("newone");
}
</script>
</body>
</html>