I'm really guessing what you want it to do, but here's what I think should be the JS code:
// a click on this button runs the code below
document.querySelector("#button").addEventListener("click", function () {
// if the button has black background color,
if (button.style.backgroundColor == 'black') {
// it will be changed to white, and the text color will become black
button.style.backgroundColor = 'white';
button.style.color = 'black';
} else {
// otherwise, button's background color will become black,
// and the text color will be changed to white
}
})
I'm really guessing what you want it to do, but here's what I think should be the JS code: