Sorry, I'm kind of new to this.
Is there a specific reason, why the if-statement in this snippet is not working? If yes, could somebody point me in the right direction?
var app = (function(){
selector = {
app: ".js-app",
app__home: ".js-app__home"
}
foo();
foo = function () {
console.log(selector.app__home);
if ($(selector.app).hasClass(selector.app__home)) {
console.log("is home page")
}
}
})();
$(document).on("ready", function() {
app();
});
The first console.log()-output (the one outside the if-statement) works correctly though. Thanks!
Aucun commentaire:
Enregistrer un commentaire