0
I’m trying to make a change in css by clicking on the word but when I use Getelementsbyclassname nothing happens, but with the ID I can do this, however as several elements will have exactly the same property, I would rather not with ID
This is the code
<script>
function ganha(){
document.getElementsByClassName("winner").style.color = "green";
}
</script>
<div class="winner" onclick="ganha()" >
Snut
</div>
Read it here: https://answall.com/questions/228670/document-getelementsbyclassname-elements-com-mais-de-umarclass
– LeAndrade