Highlight a list/library line item

I blogged on this a while back using a similar approach for MOSS 2007.  Here is a link to that post: http://saltypc.com/?p=99

Things have changed since then so here are the steps to set this up in 2013.

You will need to reference jquery for this to work.  I prefer to download the minified script and place it in a centralized location inside my farm.

  1. Add a script editor web part to the bottom of your page.
  2. Insert the following into your source:
  • <script type="text/javascript" src="http://yoursitename.com/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
     $(document).ready(function(){
      $Text = $("td.ms-cellstyle.ms-vb2:contains('Change Me')"); $Text.parent().css("background-color", "#99FF66");
     });
    </script>

Modify the Change Me to reflect the column name of your list/library.  You can also change the color to any web safe color of your choice.

To highlight mulitple column choices, simply copy the $Text line and past it below the copied line.

Example:

$Text = $(“td.ms-cellstyle.ms-vb2:contains(‘Column A)”); $Text.parent().css(“background-color”, “#FFFFFF”);

$Text = $(“td.ms-cellstyle.ms-vb2:contains(‘Column B)”); $Text.parent().css(“background-color”, “#000000”);

This comes in handy when you need to find a needle in a haystack.

 

Stay Salty!