Implementing a night mode

$('.js-go-night').click(function(){
			alert($('body').addClass('night');
		$('div').addClass('night');
		$('li').addClass('night');
		});
		
		$('.js-go-day').click(function(){
			alert($('body').removeClass('night');
		$('div').removeClass('night');
		$('li').removeClass('night');
		});

/* Trying to implement a night mode but the code is not working?*/

In what way is it not working?

switching to night mode does not happen. is there anything wrong with the code?

You haven’t shared your complete code or described which part of the code is not working as expected, so there’s only so much help we can give. From the snippet you shared it looks like you are trying to create an alert when something is clicked, but that alert is full of jQuery code. It also looks like you may have syntax errors along the lines of missing )s, but I didn’t check carefully.

1 Like

Looks like that alert has no closing parentheses.
Why do you mutate the DOM inside alert anyway?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.