I have two buttons one makes the theme dark and the other one makes the theme light I want the dark button hides when body has class name "dark" and the light button be hidden when body has class name "light".
Thank you.
>Solution :
You would do this using CSS. Let’s say you have buttons like this in your HTML:
<body class="light">
<button class="btn-light">Light</button>
<button class="btn-dark">Dark</button>
</body>
The CSS to make the appropriate buttons hidden depending on body class is this:
body.light button.btn-dark {
display: none;
}
body.dark button.btn-light {
display: none;
}