I'm having trouble understanding why the color does not change after clicking. Can anyone explain?
function butt(color) {
if(document.getElementById("bt").style.backgroundColor=="green"){
document.getElementById("bt").style.backgroundColor="purple";
}
};
document.getElementById("bt").addEventListener("click", function() {
butt("green")
});
#bt {
background-color:yellow;
border-radius:10%;
padding:10px;
margin:20px;
}
<div class="row">
<div id="forbutton">
<button type="button" id="bt">It's me MrButton !</button>
</div>
</div>