mercredi 29 novembre 2017

Jquery addClass and removeClass in if else statement not working

So i have created a class with a border. called border-check. This border only needs to show when the td.k-editable-area has no value (nothing written in the textarea).

I can add a class with the first line but once i add the if else statement it breaks down and wont add the class. So im not sure if its a problem of adding the class again or wether my if else statement is not correctly stated.

$("td.k-editable-area").addClass("border-check");

if ("td.k-editable-area" == "") {
    $("td.k-editable-area").addClass("border-check");
} else {
    $("td.k-editable-area").removeClass("border-check");
}

Aucun commentaire:

Enregistrer un commentaire