i attempted to exchange a category. discovered this working instance: javascript: exchange classList that’s right into a conditional
my modification (seen beneath) do not work.
classList.exchange
ought to exchange all courses xxx1yyy with xxxyyy
<!DOCTYPE html>
<html>
<type>
.my1bla {
background-color: black;
}
.mybla {
background-color: blue;
}
</type>
<p>Click on button to alter b type class from DIV. background-color will change from black to blue (hopefully)</p>
<button onclick="myFunction()">Attempt it</button>
<div id="myDIV" class="my1bla">
I'm a DIV component
</div>
<script>
perform myFunction() {
var x = doc.getElementById("myDIV");
if (x.classList.comprises("1")) {
x.classList.exchange("1", "");
} else if (x.classList.comprises("1")) {
x.classList.exchange("1", "");
}
}
</script>