Johnathan Johnathan - 1 year ago 61
AngularJS Question

How to I change the color of each instance of a word in a html table with css?

I have the following table in html using AngularJS:

<table id="searchTable">
<th>Reported By</th>
<th>Verified By</th>
<tr data-ng-repeat="observation in observations| filter:searchText">
<th> {{$index + 1}} </th>

In the columns "Observations","Reported By", "Verified By", and "Date", it is possible to have the string "NULL". I was wondering if there is a quick and easy way in CSS to color red each instance of "NULL" in any of the four columns? I've been stuck there for quite some time. Thank you!

Answer Source

Personally I'd suggest doing this in Jquery. You could look for all <th> elements that contain "NULL" and change them to red by doing the following...

$(document).ready(function() {

   $("th:contains('NULL')").css("color", "red");



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download