Word Counter Issue Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
3 posters

    Word Counter Issue

    avatar
    PA
    Forumember


    Posts : 219
    Reputation : 2
    Language : english

    Solved Word Counter Issue

    Post by PA July 3rd 2014, 4:37 pm

    This is a relatively simple problem with a simple answer and yet my javascript is wayy to bad.

    So I used forumotions word counter for my forum but I wanted it to only apply to a few forums, so I implemented:



    Code:
    if ($('a.nav[href^="/c1-"]').length == 0)

    At the top of the code.
    And it works, but I want to know how to apply it to several forums.
    Like only category 1, 4 and 5.
    It should just be a simple or operator but it's not working.


    Last edited by PA on July 3rd 2014, 4:53 pm; edited 2 times in total
    levy
    levy
    Hyperactive


    Male Posts : 2631
    Reputation : 350
    Language : English, Romanian
    Location : Romania

    Solved Re: Word Counter Issue

    Post by levy July 3rd 2014, 4:48 pm

    Hi,
    From my basic Js knowledges, you can create how much if statment you want, and you don't need something else than this:
    Code:
    if ($('a.nav[href^="/c1-"]').length == 0)
    if ($('a.nav[href^="/c4-"]').length == 0)
    if ($('a.nav[href^="/c5-"]').length == 0)

    I'm not very sure if it will work, you can try it or you can wait for Ange Tuteur. Smile
    avatar
    PA
    Forumember


    Posts : 219
    Reputation : 2
    Language : english

    Solved Re: Word Counter Issue

    Post by PA July 3rd 2014, 4:55 pm

    I tried it like this:

    Code:
     if ($('a.nav[href^="/c1-"]').length == 0);
    if ($('a.nav[href^="/c3-"]').length == 0) return;

    Didnt work
    avatar
    PA
    Forumember


    Posts : 219
    Reputation : 2
    Language : english

    Solved Re: Word Counter Issue

    Post by PA July 3rd 2014, 4:56 pm

    Nevermind, it worked! Hah..
    WOW
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Word Counter Issue

    Post by SLGray July 3rd 2014, 6:44 pm

    Problem solved & topic archived.



    Word Counter Issue Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.