Forum Discussion
Highlighting a row when a dropdown option is selected (Overwrite formatting code)
I was attempting to highlight a whole row (just the background) red when a dropdown option labeled (Archive) in a column labeled (Status) is selected.
This code works (by itself) when the list does not contain any formatting code:
<script src="http://code.jquery.com/jquery-1.11.1.js"> </script> <script> $(document).ready(function(){ $Text = $("td .ms-vb2:contains('archive')"); $Text.parent().css("background-color", "Red"); }); </script>
I am trying to get the code listed above to overwrite the formatting code listed below does anyone know how to accomplish this?
Basically, I need use both codes simultaneously.
I have this code in my content editor which changes the layout/font/table of my list:
<style type="text/css"> table.ms-listviewtable tr:nth-child(2n+1) td, table.ms-listviewtable tr th { background-color: #efefef; /*border-bottom-color: #d5d5d5 !important;*/ border-top-color: #d5d5d5 !important; border-width: 1px !important; font-family: Calibri !important; border-collapse: collapse !important; } table.ms-listviewtable tr:nth-child(2n) td, table.ms-listviewtable tr th { background-color: #f9f9f9; /*border-bottom-color: #d5d5d5 !important;*/ border-top-color: #d5d5d5 !important; border-width: 1px !important; font-family: Calibri !important; border-collapse: collapse !important; } .ms-core-pageTitle, .ms-core-pageTitle a {font-weight: Bold} .ms-vb2, .ms-vb, .ms-vb a, .ms-vb-user A {font-size: 10pt; color: black; font-family: Calibri} .ms-vh-div, .ms-vh-div A {font-size: 11pt; color: black; font-weight: Bold; font-family: Calibri} tr.ms-viewheadertr > th.ms-vh2-nograd, tr.ms-viewheadertr > th.ms-vh-icon, /* Input box and attachment icon */ tr.ms-viewheadertr > th.ms-vh, /* Text */ tr.ms-viewheadertr > th.ms-vh2, tr.ms-viewheadertr >th.ms-vh2-nofilter, tr.ms-viewheadertr >th.ms-vh-div/* Text */ { background: #D3D3D3; } .ms-listviewtable>thead>tr>th:last-child { background-color:transparent!important; color:transparent!important; } .ms-viewheadertr th[aria-label="Open Menu"] { background-color: #d5d5d5; } .ms-vb a.ms-listlink, .ms-vb2 a.ms-listlink, .ms-vb-user a.ms-listlink, .ms-vb a.ms-listlink:visited, .ms-vb a.ms-listlink:hover:visited {font-size: 10pt; font-weight: Bold; color: black; font-family: Calibri} .ms-subtleLink:link, .ms-subtleLink:visited, .ms-atMention:link, .ms-atMention:visited, .ms-hashTag:link, .ms-hashTag:visited { color: black; } </style>