I'm trying to see if a checkbox is true or false and then alert something if it's one or the other, but I can't seem to figure out what I'm doing wrong. Eventually I want to set a cookie if the checkbox is true. Can anyone help me solve this problem? Right now it constantly alerts hello.
$('#night-mode').on('click', function(){
$('#team-select').css('background', '#313131');
$('.color').css('background', '#313131');
$('html .game-cards, body .game-cards').css('background', '#737373');
$('html .menu li a, body .menu li a').css('color', '#9ecd1a');
$('html .menu select, body .menu select').css('background', '#9ecd1a');
if ($('input.night-mode').prop('checked', false)){
alert('hello')
} else if($('input.night-mode').prop('checked', true)){
alert('not-checked')
}
});
Aucun commentaire:
Enregistrer un commentaire