Seems correct but doesn't work


#1

Here is my code. I think it is correct but when I try it, it doesn't seem to work. Any ideas??

var main = function() {
$('.day').click(function() {
$(this).next().toggle();
$(this).find('.weekday span').toggleClass('.glyphicon-minus');

};

$(document).ready(main);


#2

Hi your missing a closine ‘});’ for the click function()
the code should be

var main = function() {
$('.day').click(function() {
$(this).next().toggle();
$(this).find('.weekday span').toggleClass('.glyphicon-minus');
});
};

$(document).ready(main);
try that.


#3

thanks - got it. You were correct.


#4

Actually you only need to use find('span') in order to toggle the minus glyphicon. The instructions are just letting you know where you can find it if need be.


#5

try: $(this).find('span').toggle('.glyphicon-minus');


#6

well actually it should be
$(this).find('.weekday span').toggleClass('glyphicon-minus');
without the full stop before glyphicon-minus


#7

What is ('.weekday span') and how does it help here?
Also, where is ('glyphicon minus')? I dont see it anywhere in the code.