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.
The forum of the forums
2 posters

    Code wrong??

    njaguar
    njaguar
    Forumember


    Male Posts : 113
    Reputation : 1
    Language : English
    Location : United Kingdom

    Solved Code wrong??

    Post by njaguar December 8th 2013, 2:52 am

    Why does the first two codes work but the last doesn't? there the same....

    Code:
    $(function() {
            if($('a[href="/u1"] span strong')){
                        $('a[href="/u1"] span strong').after('<img src="http://forums.d2jsp.org/images/s55.png" border="0" />');
                }
            });

    $(function() {
            if($('a[href="/u3"] span strong')){
                        $('a[href="/u3"] span strong').after('<img src="http://www.d3jsp.org/images/stars/92.gif" border="0" />');
                }
            });

    $(function() {
    if($('a[href="/u8"] span strong')){
                $('a[href="/u8"] span strong').after('<img src="http://cdn2.iconfinder.com/data/icons/ledicons/crown.png" border="0" />');
        }
    });
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Code wrong??

    Post by Ange Tuteur December 8th 2013, 3:51 am

    Hello njaguar,

    I do not think javascript is necessary for this. You can use CSS instead to add an image to users.

    Code:
    a[href="/u1"] span strong:after { content:url(http://forums.d2jsp.org/images/s55.png) }

    a[href="/u3"] span strong:after { content:url(http://www.d3jsp.org/images/stars/92.gif) }

    a[href="/u8"] span strong:after { content:url(http://cdn2.iconfinder.com/data/icons/ledicons/crown.png) }
    For user #8 are they in a group? These selectors are for users that are bold and colored. i.e. in a group. If they're not in a group then the selectors will not work.
    njaguar
    njaguar
    Forumember


    Male Posts : 113
    Reputation : 1
    Language : English
    Location : United Kingdom

    Solved Re: Code wrong??

    Post by njaguar December 8th 2013, 4:21 am

    no they are a user Sad
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Code wrong??

    Post by Ange Tuteur December 8th 2013, 4:44 am

    Then you can create a default group that members join upon registration. It should have the following options, and should color the group members.

    Code wrong?? Captu191

    Auto-subscribe needs to be at '0' posts.
    njaguar
    njaguar
    Forumember


    Male Posts : 113
    Reputation : 1
    Language : English
    Location : United Kingdom

    Solved Re: Code wrong??

    Post by njaguar December 8th 2013, 4:50 am

    Done thank you
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Code wrong??

    Post by Ange Tuteur December 8th 2013, 4:51 am

    Is this solved?
    njaguar
    njaguar
    Forumember


    Male Posts : 113
    Reputation : 1
    Language : English
    Location : United Kingdom

    Solved Re: Code wrong??

    Post by njaguar December 8th 2013, 4:55 am

    Yes
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Code wrong??

    Post by Ange Tuteur December 8th 2013, 4:59 am

    Topic solved and archived

      Current date/time is September 22nd 2024, 10:18 pm