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

    Background color for topics that contain a certain string

    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Background color for topics that contain a certain string Empty Background color for topics that contain a certain string

    Post by Ace 1 1/1/2016, 10:30

    I want the topic to have a certain bgcolor if the topictitle contains the string "New"

    Thanks :3
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Background color for topics that contain a certain string Empty Re: Background color for topics that contain a certain string

    Post by Ace 1 3/1/2016, 01:20

    bump.
    10spetter10
    10spetter10
    Forumember


    Posts : 195
    Reputation : 82
    Language : Dutch

    Background color for topics that contain a certain string Empty Re: Background color for topics that contain a certain string

    Post by 10spetter10 3/1/2016, 11:20

    Is it for a phpBB3 forum? Then you can try this javascript. It will add 'selected' to the rows of the topic with 'new' in their titles.

    Code:
    $(function() {
      var str = 'new';
      $('ul.topiclist.topics li.row').each(function() {
          var title = $(this).find('a.topictitle').html();
          if(title.toLowerCase().indexOf(str) >= 0) {
            $(this).addClass('selected');
          }
      });
    });

      Current date/time is 23/9/2024, 11:20