Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Highlight rows in a SharePoint list.
<script src=https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js></script>
<script>
jQuery(function() {
function applyStyles() {
jQuery(".ms-listviewtable tbody tr td:nth-child(3):contains('Required')").parent().css('background-color','red');
jQuery(".ms-listviewtable tbody tr td:nth-child(3):contains('Conditionally Required')").parent().css('background-color','blue');
jQuery(".ms-listviewtable tbody tr td:nth-child(3):contains('Additional Services')").parent().css('background-color','yellow');
jQuery(".ms-listviewtable tbody[id*='titl'] > tr > td > span").remove()
}
applyStyles();
jQuery(window).on('hashchange', function() {
applyStyles();
});
var regExp = /ExpCollGroup(.*)\)/
$('.ms-commentexpand-iconouter,.ms-commentcollapse-iconouter').closest('a').each(function() {
$(this).on('click', function() {
applyStyles();
});
});
var _ExpCollGroup = ExpCollGroup;
ExpCollGroup = function (groupName, imgName, evt, noAjax) {
_ExpCollGroup(groupName, imgName, evt, noAjax);
setTimeout(function() {
applyStyles();
}, 500);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment