I have a variable that gets the text from a div. I compare that text using an if statement and then apply CSS to it depending on if it is true or false. For some reason, I cannot get it to work. The variable is getting the correct text because I verified through console.log but the if statement is not working. Here is my code:
$(document).ready(function(){
var singleStatus = $('.single-status').text();
console.log(singleStatus); // This outputs 'Pending' to the console
if(singleStatus === 'Pending'){
$('.single-status').css('color', '#f2721d'); // This does nothing
console.log(singleStatus); // This does nothing...
}
});
$.trim()the string to remove any unwanted whitespace around the text.==instead of===