This forum is now read-only. Please use our new forums! Go to forums
10/12 Why won't my code work?
Hi, I can’t figure out what is wrong with my code. I checked the hint and it is exactly same. Please go through it and help me figure it out.
Thanks a lot!
$(‘.arrow-prev’).click(function() { var currentslide = $(‘.active-slide’); var prevslide = currentslide.prev();
var currentdot = $('.active.dot');
var prevdot = currentdot.prev();
if(prevslide.length === 0){
prevslide = $('.slide').last();
}
currentslide.fadeOut(600).removeClass('active-slide');
prevslide.fadeIn(600).addClass('active-slide');
currentdot.removeClass('active-dot');
prevdot.addClass('active-dot');
});
Answer 55b6a26b9113cb48eb00002b
I am having the same problem, getting a “TypeError: currentSlide.removeCLass is not a function” message. I have found that by breaking the “currentSlide.fadeOut(600).removeClass(‘active-slide’);” statement down to “currentSlide.fadeOut(600)” the exercise works but that still leaves the “active-slide” class associated with the currentSlide. This seems to be an issue with the “removeClass()” but I haven’t been able to find the problem. Syntax looks fine…. The “addClass(‘active-slide’)” works fine so I’m at a bit of a lose myself… I have also tried “$(‘.active-class’).removeClass(‘active-class’)” but get a similar “….removeClass is not a function” message… Post something if you find it….
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
2 comments
—————— I found my error….. In an earlier occurrence of “removeClass” I had an uppercase “L”, removeCLass…. when I corrected that to lowercase “l” all was well….
great!!
The error i am getting is “It looks like previous arrow isn’t moving back to the previous dot. Look back at the instructions and check the $(‘.arrow-prev’).click() event handler “