DomTokenList.remove()
is the oppisite of add()
and is used to remove specific tokens from the list. You can see from the example below that you can use it to stylize webpages (ex: having light and dark modes).
<body>
<div>
<h1>
Nothing
</h1>
<br>
<button onclick="change()" ondblclick="returns()">
change
</button>
</div>
</body>
body {
display: flex;
align-items: center;
justify-content: center;
}
.something {
background-color: #2F004F;
color: white;
font-style: italic;
}
function change() {
document.body.classList.add('something');
}
function returns() {
document.body.classList.remove('something');
}