mercredi 14 décembre 2016

this closest has class not working

I have a button on a slider en if you get to a specific slide I want to show some text.

The button has class step-submit

The slide allways has class step

and my slides are .step-1, .step-2 ...

$(".step-submit").on("click", function(){
    console.log($(this).closest(".step"));

    if($(this).closest(".step").hasClass(".step-4") || $(this).closest(".step").hasClass(".step-5")){
        $(".test").show();
    }
});

I can see the correct step is being printed with the correct classes but the if statement doesn't equal true. I really hope someone can help me out because i'm really stuck here.

Aucun commentaire:

Enregistrer un commentaire