jeudi 20 octobre 2016

Jquery else if issues [on hold]

I can't get the else if statement to work in jquery. I don't know if the syntax is correct. I want to add the html paragraph to the div depending on which size class it is.

$(document).ready(function() {
    if ($(this).hasClass(".size5")) {
        $("div.plan-accessible-alt").html("<p> Blah Blah Size5</p>");
    } else if  
        ($(this).hasClass(".size4")) {
        alert('TEST!!!');
        $("div.plan-accessible-alt").html("<p> Blah Blah Size4</p>");
    } else if  
    ($(this).hasClass(".size3")) {
        alert('TEST 3!!!');
        $("div.plan-accessible-alt").html("<p> Blah Blah Size3</p>");
    }
});

Aucun commentaire:

Enregistrer un commentaire