Source Code: (back to article)
<div id="toggleClassExample">Click me to toggle the highlight class.</div>
<button onclick="toggleClass()">Toggle Class</button>

<script>
function toggleClass() {
const element = document.getElementById('toggleClassExample');
element.classList.toggle('highlight');
}
</script>

<style>
.highlight {
background-color: yellow;
}

.text-large {
font-size: 24px;
}
</style>