My code doesn't work Next dot 1


This is my code but i get the error message Remember to remove the "Active dot" from the correct dot.

 var main = function () {
    $('.dropdown-toggle').click(function() {
    $('.arrow-next').click(function() {
        var currentSlide = $('.active-slide');
        var nextSlide =;
        var currentDot = $('.active-dot');
        var nextDot =;

        if (nextSlide.length == 0) {
            nextSlide = $('.slide').first();



With the nextSlide.length test
your are testing if you are going past the last-Slide available
and if so
you want to set the nextSlide pointing to the first-Slide.....

You are using an IF statement structure to do this.

The build of such an IF-statement consists of

  • a_condition_ like you are using
    if (nextSlide.length == 0)
  • and an IF-code-block which is encapsulated in a pair of curly-brackets-{ }
    { nextSlide = $('.slide').first(); }

( so in short you are forgetting the closing-curly-bracket-} for your IF-code-block )

Now to the structure of your =main= function

The structure of the =main= function should look like

var main = function() {
     //Begin of =main= FUNCTION-BODY

        $('.arrow-next').click( function() {
             //code which gets executed when =click=ed
        $('.arrow-prev').click( function() {
             //code which gets executed when =click=ed
     //End of =main= FUNCTION-BODY

And the =main= function should be executed when the document is fully loaded and READY

$(document).ready( main );


++ jquery length explained AND DOM pictures of flipboard


ok!! it worked thanks!!


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