lundi 22 juin 2020

jQuery IF this OR that

can someone help me out with what I'm doing wrong here:

if ($('.c-user-name a span:contains("User 1")') || $('.c-user-name a span:contains("User 2")')) {
    $('#admin-links').css('display', 'block');
};

Basically, I'm trying to change CSS if a specific user is logged in.

Also, if there's a better way of doing this, I'd love to know. We may have more than 2 users that need this and the condition could get quite long!

Aucun commentaire:

Enregistrer un commentaire