アクティブなボタンのテキストの色を白に変更し、他のボタンのテキストの色を非アクティブにしたままにするにはどうすればよいですか?アクティブなボタンのテキストの色を変更するには?
JavaScriptで<button class="tablink tab" onclick="openPrices('Ladies', this, '#0b0c0d')" id="defaultOpen">Ladies services</button>
<button class="tablink tab1" onclick="openPrices('Mens', this, '#0b0c0d')">Mens services</button>
<button class="tablink tab2" onclick="openPrices('Colour', this, '#0b0c0d')">Colour services</button>
<script>
function openPrices(pricesName, elmnt, color) {
// Hide all elements with class="tabcontent" by default */
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Remove the background color of all tablinks/buttons
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].style.backgroundColor = "";
}
// Show the specific tab content
document.getElementById(pricesName).style.display = "block";
// Add the specific color to the button used to open the tab content
elmnt.style.backgroundColor = color;
}
// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>