Untitled

mail@pastecode.io avatar
unknown
html
a month ago
628 B
4
Indexable
Never
Şunu:
<button class="showhidebutton" onclick="showhidefunction()">Click to Show Solution</button>
Şununla değiştir:
<button class="showhidebutton" onclick="showhidefunction(button)">Click to Show Solution</button>


Şunu da:
function showhidefunction() {
 var element = document.getElementById("solutionhide");
 element.classList.toggle("solutionshow");
}

Şununla:
function showhidefunction(button) {
 var element = document.getElementById("solutionhide");
 element.classList.toggle("solutionshow");
 button.textContent = element.classList.contains("solutionshow") ? "Click to Hide Solution" : "Click to Show Solution";
}
Leave a Comment