Skip to content
Sign upLog in
← Back to Community
Can anyone help me code?
Profile icon
prestondavis132

add me on discord i need help figuring out code for html, lua...

Clout#6757

Voters
Profile icon
saifalhusainy1
Profile icon
prestondavis132
Comments
hotnewtop
Profile icon
ch1ck3n

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 } })