Hey, I'm completely new to web development and decided to practice some of the concepts I've been learning about.
I created a simple program that toggles between day and night. Clicking on the sun reveals the moon, and clicking on the moon reveals the sun. You'll notice that by default, the text "Good Afternoon!" and "Good Night!" are displayed. I would like the text "Good Afternoon!" to only appear when the sun is visible, and "Good Night!" to only appear when the moon is visible. Any guidance on how to achieve this would be greatly appreciated.
You can find the code in this fiddle.
I attempted to write code that would replicate the behavior of the existing program, but I am aware that it is not correct:
/*toggle text*/
if ($('#daytext').hasClass('visible')) {
$('#daytext').removeClass('visible');
} else {
$('#daytext').removeClass('visible');
}