botão de alternância de javascript
<button id="btn"> Click </button>
<p class="demo">YES</p>
<script>
let btn = document.querySelector("#btn");
btn.addEventListener("onclick", function() {
let value = document.querySelctor("#demo").innerHTML;
if(value == "YES"){
document.querySelctor("#demo").innerHTML = "NO";
}else{
document.querySelctor("#demo").innerHTML = "YES";
}
});
</script>
Hamza Dev