[Solved] Forecast - Task 4 unclear


#1

Hi,
I didn't quite understand what is asked of me in Task 4 - I do understand I need to change the class from "glyphicon-plus" to "glyphicon-minus", but beside the fact the I didn't manage to do it (probably doing something wrong), I didn't understand the instruction "Use .find() the element inside the .weekday div".
I've tried to use .toggleClass without much success, and tried playing with .find().
Help?


Solved the issue by calling .toggleClass twice on .glyphicon - once on glyphicon-plus, and once on glyphicon-minus. still can't understand the need to use .find() as written in the instructions.


#2

Had some problems with this but here is my solution in case anyone else has difficulties:

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

};

$(document).ready(main);

#3

Also I believe it works to just have .toggleClass(.glyphicon-minus) as it replaces the existing .glyphicon-plus class.

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

$(document).ready(main);


#4

The last sentence of Task 4 is worded rather poorly!


#5

I agree. This course is not as thorough as the others. A pattern of concept and project is a better pace than a bunch of concepts followed by a bunch of projects. Question 4 needs to be revised.


#6

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

$(document).ready(main);

I added the slideToggle() method to add a bit of animation to it