Skip to content

Instantly share code, notes, and snippets.

@sarasantos

sarasantos/Change-Color-Buttons Secret

Created Oct 10, 2020
Embed
What would you like to do?
function onMessage(event) {
var state;
if (event.data == "1"){
state = "ON";
document.getElementById('button').style.backgroundColor = "COLOR_FOR_ON_BUTTON";
}
else{
state = "OFF";
document.getElementById('button').style.backgroundColor = "COLOR_FOR_OFF_BUTTON";
}
document.getElementById('state').innerHTML = state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.