I want to change the body's class. If I click on the red button then body's class should be bg-red
. If I click on the dark button, the class should be bg-dark
. using jQuery
CSS
button {
padding: 10px 30px;
border: 0;
text-align: center;
display:inline-block;
}
.light {
background-color:#f9f9f9;
color: #000000;
}
.dark {
background-color:#000000;
color: #ffffff;
}
.red {
background-color:#ff0000;
color: #ffffff;
}
HTML
<body class="bg-dark">
<button type="submit" class="light">Light</lbutton>
<button type="submit" class="dark">Dark</button>
<button type="submit" class="red">Red</button>
</body>