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

    Javascript not working

    Mati
    Mati
    Active Poster


    Posts : 1927
    Reputation : 331
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Javascript not working

    Post by Mati November 21st 2014, 10:44 am

    I'm using this Javascript to add a text before the Forum name:


    Code:
    $(document).ready(function(){
    $('img[src="http://i59.servimg.com/u/f59/14/73/12/96/status10.png"]').replaceWith('<div id="new-mes">New</div>')
    });

    This is the Forum - New icon, and this is the example!
    Javascript not working Status10 News & Announcements New
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Javascript not working

    Post by Ange Tuteur November 21st 2014, 10:50 am

    Hello Mati,

    Try this :
    Code:
    $(function() {
     Â $('.forabg dl[style*="http://i59.servimg.com/u/f59/14/73/12/96/status10.png"]').append('<div id="new-mes">New</div>');
    });

    The images are set as backgrounds in phpbb3, so you have to check the style attribute.
    Mati
    Mati
    Active Poster


    Posts : 1927
    Reputation : 331
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Javascript not working

    Post by Mati November 21st 2014, 11:54 am

    Oki, but how to make it so can show before the forumtitle and not before lastpost see -> http://fmfocus.forumotion.net/forum
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Javascript not working

    Post by Ange Tuteur November 21st 2014, 12:06 pm

    See if this works :
    Code:
    $(function() {
      $('.forabg dl[style*="http://i59.servimg.com/u/f59/14/73/12/96/status10.png"]').find('a.forumtitle').append('<div id="new-mes">New</div>');
    });
    Mati
    Mati
    Active Poster


    Posts : 1927
    Reputation : 331
    Language : HTML, CSS & JavaScript
    Location : Forum Services

    Solved Re: Javascript not working

    Post by Mati November 21st 2014, 12:19 pm

    Perfect thank you so much for your help. Smile
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Javascript not working

    Post by Ange Tuteur November 21st 2014, 12:30 pm

    You're welcome Javascript not working 1852325475

    Topic archived

    Have a great day. Smile

      Current date/time is September 22nd 2024, 2:43 pm