In my below coe the console.log
fires, so the if
statement is definitely passing. If I try to console.log()
the CSS of $(this)
I get undefined
. I've done console.log($this)
and it returns an object with outer HTML <span class="formState"></span>
. I've had a few friends look at this and have done a lot of research but have come up short.
<span class="formState"><?php echo $IRFormResults[$count];$count++ ?></span>
$(".formState").each(function() {
if ($(this).text() == 'n/a') {
console.log('Got an n/a');
$(this).css('color:red');
}
.formState {
color: green;
display: inline-block;
min-width: 125px;
margin-left: 10px;
float:right;
}